Skip to content

Instantly share code, notes, and snippets.

View Tivoli's full-sized avatar

Jonathan Rainey Tivoli

View GitHub Profile
@Tivoli
Tivoli / swipeEvents.js
Last active August 4, 2016 09:03
Javascript Swipe Events
function getSwipeEvent(deltaX, deltaY) {
switch(true) {
case deltaX >= 50: return new Event('swipeLeft');
case deltaX <= -50: return new Event('swipeRight');
case deltaY >= 50: return new Event('swipeUp');
case deltaY <= -50: return new Event('swipeDown');
}
}
function swipeEvents() {
@Tivoli
Tivoli / app.js
Created May 16, 2015 00:39
Isomorphic React
'use strict';
import React from 'react';
import Router from 'react-router';
import { canUseDOM } from 'react/lib/ExecutionEnvironment';
import routes from './routes';
let app = {
start(bootstrap) {
return canUseDOM ? this.webStart() : this.serverStart(bootstrap);
{
"query": {
"count": 1,
"created": "2015-04-29T19:52:26Z",
"lang": "en-US",
"results": {
"quote": {
"symbol": "aapl",
"Ask": "129.2400",
"AverageDailyVolume": "53100600",
@Tivoli
Tivoli / mixins.coffee
Last active December 27, 2015 08:39
My collection of defaults and mixins for less and underscore in coffeescript.
_.mixin
isEmail: (string) ->
/^[a-z0-9_.%+\-]+@[0-9a-z.\-]+\.[a-z]{2,6}$/i.test(string)
isUsername: (string) ->
/^[\w\d\.-]{1,15}$/i.test(string)
isName: (string) ->
/^(?:[\u00c0-\u01ffa-zA-Z'-]){2,}(?:\s[\u00c0-\u01ffa-zA-Z'-]{2,})+$/i.test(string)
make[1]: Entering directory `/root/tmp/tmp-27205ddftegw/build/package/node_modules/mongodb/node_modules/bson/build'
CXX(target) Release/obj.target/bson/ext/bson.o
[ws v0.4.22] Attempting to compile blazing fast native extensions.
../ext/bson.cc: In member function 'void DataStream::CheckKey(const v8::Local<v8::String>&)':
../ext/bson.cc:64:52: error: 'alloca' was not declared in this scope
make[1]: *** [Release/obj.target/bson/ext/bson.o] Error 1
make[1]: Leaving directory `/root/tmp/tmp-27205ddftegw/build/package/node_modules/mongodb/node_modules/bson/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/opt/local/lib/node_modules/node-gyp/lib/build.js:219:23)