Skip to content

Instantly share code, notes, and snippets.

@jasondavies
jasondavies / index.html
Created September 10, 2012 08:33
longscroll.js
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.longscroll {
overflow-y: auto;
width: 480px;
height: 500px;
float: left;
}
.longscroll .row {
@apeckham
apeckham / gist:3276533
Created August 6, 2012 16:50
emulate devicemotion event using phonegap's watchAcceleration
$(document).on({
deviceready: function () {
if (!('ondevicemotion' in window)) {
navigator.accelerometer.watchAcceleration(function (acceleration) {
var event = document.createEvent('Event');
event.initEvent('devicemotion', true, true);
event.accelerationIncludingGravity = acceleration;
window.dispatchEvent(event);
}, $.noop, {frequency: 250});
}
@firedfox
firedfox / onDOMContentLoaded.js
Created April 24, 2012 02:12
phantomjs onDOMContentLoaded
const PHANTOM_FUNCTION_PREFIX = '/* PHANTOM_FUNCTION */';
var page = require('webpage').create();
page.onConsoleMessage = function(msg) {
if (msg.indexOf(PHANTOM_FUNCTION_PREFIX) === 0) {
eval('(' + msg + ')()');
} else {
console.log(msg);
}
@joelambert
joelambert / README
Created June 1, 2011 11:03
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php