Skip to content

Instantly share code, notes, and snippets.

View ethagnawl's full-sized avatar
🐢

Pete Doherty ethagnawl

🐢
View GitHub Profile
@ethagnawl
ethagnawl / rAF.js
Created March 4, 2014 17:40 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@ethagnawl
ethagnawl / rAF.js
Created March 4, 2014 17:50 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
"use strict";
define(function () {
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
/*
* Set up factories, then create them in tests with (for example):
*
* LineItemFactory();
*
* Or with attributes / overrides:
*
* LineItemFactory({
* "id": 123,
* "order": OrderFactory({"firstName": "Example Associated Record Override"}),
var times = {
Schedule: {
"2014-09-26T00:00:00": [1,23],
"2014-09-27T00:00:00": [9,14]
}
};
function formatHour(hour) {
return hour > 12 ?
$(document).ready(function(){
countdown();
setInterval(countdown, 1000);
function countdown () {
var now = moment(), // get the current moment
// May 28, 2013 @ 12:00AM
then = moment([2013, 4, 28]),
// get the difference from now to then in ms
ms = then.diff(now, 'milliseconds', true);
// If you need years, uncomment this line and make sure you add it to the concatonated phrase
@ethagnawl
ethagnawl / Mobile
Last active August 29, 2015 14:22 — forked from hugeuser/Mobile
var delta;
dragThreshold = 0.15;// "percentage" to drag before engaging
dragStart = null; // used to determine touch / drag distance
percentage = 0,
target,
previousTarget;
function touchStart(event) {
if (dragStart !== null) { return; }
@ethagnawl
ethagnawl / CSS
Last active August 29, 2015 14:22 — forked from hugeuser/CSS
#projects {
height:100%;
}
.slide {
position: absolute;
top:0;
left:0;
height: 0;
width: 100%;
@ethagnawl
ethagnawl / JavaScript
Last active August 29, 2015 14:22 — forked from hugeuser/JavaScript
var delta;
var currentSlideIndex = 0;
function elementScroll (e) {
// --- Scrolling up ---
if (e.originalEvent.detail < 0 || e.originalEvent.wheelDelta > 0) {
delta--;
@ethagnawl
ethagnawl / onerror.coffee
Last active December 9, 2015 17:18 — forked from anonymous/gist:4302682
An onerror handler that's a helluva lot more useful than `... catch(e) { alert(e) }`.You can easily hook this into a custom Google Analytics event to log your app's errors. Inspired by: http://bytes.com/topic/javascript/answers/90742-try-catch-error-handling-display-line-number
onerror = (err, file, line) ->
logger """ # console.log, alert, whatever
The following error occured: #{err}
In file: #{file}
At line: #{line}
"""