Skip to content

Instantly share code, notes, and snippets.

View heaversm's full-sized avatar

Mike Heavers heaversm

View GitHub Profile
@tobitailor
tobitailor / get_barcode_from_image.js
Created June 1, 2010 19:33
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
@tdreyno
tdreyno / easing.scss
Created May 7, 2011 02:02
Easing functions for Sass 3.1
@function linear() {
@return cubic-bezier(0.250, 0.250, 0.750, 0.750); }
@function ease() {
@return cubic-bezier(0.250, 0.100, 0.250, 1.000); }
@function ease-in() {
@return cubic-bezier(0.420, 0.000, 1.000, 1.000); }
@function ease-in-quad() {
@return cubic-bezier(0.550, 0.085, 0.680, 0.530); }
@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
@PhilippSoehnlein
PhilippSoehnlein / modernizr-test_position_fixed_ios.js
Created November 3, 2011 12:23
Modernizr Test for position fixed (including iOS tests)
/* modernizr-test_position_fixed_ios.js
* Original by Daniel Ott (https://gist.github.com/1333800)
* 3 March 2011
* Updated by Philipp Söhnlein 3 November 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.
@localpcguy
localpcguy / swipeFunc.js
Created November 17, 2011 16:00
Simple Mobile Swipe function to get the swipe direction
var swipeFunc = {
touches : {
"touchstart": {"x":-1, "y":-1},
"touchmove" : {"x":-1, "y":-1},
"touchend" : false,
"direction" : "undetermined"
},
touchHandler: function(event) {
var touch;
if (typeof event !== 'undefined'){
@diorahman
diorahman / client.html
Created December 26, 2011 03:34
Ajax, call jQuery POST to node.js expressjs
<html>
<head>
<title>jsonp test</title>
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(function(){
$('#select_link').click(function(e){
e.preventDefault();
console.log('select_link clicked');
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// 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'];
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@sergiolopes
sergiolopes / README.md
Created February 28, 2012 21:57
Pure CSS fix to iOS zoom bug on device rotation

My approach to fix the iOS bug is documented here:

https://github.com/sergiolopes/ios-zoom-bug-fix

Here I present one experiment with a pure CSS solution, no JS required. It uses width=device-width normally (no device-height hacking) and scales down the page on landscape.

Works fine on all iOS versions.

There's only one problem: on old iOS versions (prior to 4.3.5), the page will get a big empty space at bottom, below the content, when on landscape. Recent iOS versions don't show this behavior.

@andris9
andris9 / git-cache-meta.sh
Created March 5, 2012 13:15
git-cache-meta
#!/bin/sh -e
#git-cache-meta -- simple file meta data caching and applying.
#Simpler than etckeeper, metastore, setgitperms, etc.
#from http://www.kerneltrap.org/mailarchive/git/2009/1/9/4654694
#modified by n1k
# - save all files metadata not only from other users
# - save numeric uid and gid
# 2012-03-05 - added filetime, andris9