Skip to content

Instantly share code, notes, and snippets.

const express = require('express');
const https = require('https');
const fs = require('fs');
const proxy = require('http-proxy-middleware');
const app = express();
app.use('/api1', proxy({
target: 'https://example.com/one-api',
changeOrigin: true,
@brandontrowe
brandontrowe / rxjs.swipeLeft.js
Created August 8, 2017 01:11
RxJS Swipe Left Observable
const tolerance = 200; // swipe distance in pixels
const swipeLeft$ = Rx.Observable.fromEvent(document, "touchstart")
// Switch to listen to touchmove to determine position
.switchMap(startEvent =>
Rx.Observable.fromEvent(document, "touchmove")
// Listen until "touchend" is fired
.takeUntil(Rx.Observable.fromEvent(document, "touchend"))
// Output the pageX location
.map(event => event.touches[0].pageX)
// Accumulate the pageX difference from the start of the touch
'use strict';
const gulp = require('gulp');
const events = require('events');
const eventEmitter = new events.EventEmitter();
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');
const autoprefixer = require('gulp-autoprefixer');
const prompt = require('gulp-prompt');
const gutil = require('gulp-util');
const browserSync = require('browser-sync').create();
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
<hr>
<p><strong>Paragraph style:</strong>&nbsp;<a href="#">Lorem ipsum dolor sit amet,</a> consectetur adipiscing elit. <em>Nullam eget tristique arcu.</em> Sed id faucibus dui, et vestibulum nulla. Integer nunc mi, luctus et ipsum in, lobortis faucibus nunc. Praesent sagittis, dolor a dapibus suscipit, elit dolor dignissim est, non dictum sapien purus id tellus. Ut sapien erat, dictum id lorem non, ullamcorper tincidunt ipsum. Fusce vulputate dapibus nisi sit amet malesuada. Suspendisse iaculis cursus leo. Maecenas blandit mauris ac vulputate elementum. Integer cursus non lacus ac suscipit. Morbi at nulla ornare, venenatis tellus eget, cursus eros. Fusce ut aliquam diam. Sed at congue risus. Donec lacinia, erat id iaculis pharetra, ante eros vestibulum metus, sed laoreet nulla nulla a lacus. Integer hendrerit eu odio vitae faucibus.</p>
$.fn.extend({
/**
* Outputs a timer to an element in the DOM
* @param {number} seconds - A positive
*/
countdownTimer: function (time) {
return this.each(function () {
var $this = $(this);
var timer = time;