Skip to content

Instantly share code, notes, and snippets.

View wamatt's full-sized avatar

Matt Tagg wamatt

  • Palo Alto, California
View GitHub Profile
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@sindre
sindre / gist:962201
Created May 9, 2011 07:37
JS createDocumentFragment to avoid reflow
// http://www.slideshare.net/nzakas/high-performance-javascript-amazon-devcon-2011
var list = document.getElementsByClassName('items')[0],
fragment = document.createDocumentFragment(),
i, item;
for (i=0; i < 10; i++) {
item = document.createElement('li');
item.innerHTML = 'item #'+i;
fragment.appenChild(item);
}
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@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'];
@Watson1978
Watson1978 / macruby_uninstall
Created February 27, 2012 23:43
MacRuby : uninstaller
#!/bin/bash
# MacRuby
rm -rf /Library/Frameworks/MacRuby.framework
XCODE_DIR=`xcode-select -print-path`
# tool
rm -f "$XCODE_DIR"/usr/bin/rb_nibtool
rm -f "$XCODE_DIR"/Tools/rb_nibtool
@cowboy
cowboy / sudo-keepalive-example.sh
Created July 15, 2012 20:55
Bash: Sudo keep-alive (good for long-running scripts that need sudo internally but shouldn't be run with sudo)
#!/bin/bash
# Might as well ask for password up-front, right?
sudo -v
# Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Example: do stuff over the next 30+ mins that requires sudo here or there.
function wait() {
@dschep
dschep / gist:4105713
Last active March 21, 2023 01:47
Gmvault on Synology NAS
  1. Install Python from DSM Package Center
  2. Enable SSH
  3. SSH in
  4. Enable and switch to user shell (optional, requres user homes to be enabled)
    • set shell to /bin/ash in /etc/passwd
    • su - <user>
  5. Create directory to store all of this (optional)
    • mkdir gmvault&&cd gmvault
  6. Get virtualenv
  • wget https://raw.github.com/pypa/virtualenv/develop/virtualenv.py
@gavinandresen
gavinandresen / btcpayments.rst
Last active March 28, 2021 06:40
Bitcoin Payment Messages

SEE BIP 70

See https://en.bitcoin.it/wiki/BIP_0070 for the latest version of this document; I'll keep this document so the process of discussion/revision isn't lost.

Bitcoin Payment Messages

This document proposes protocol buffer-based formats for a simple payment protocol between a customer's bitcoin client software and a merchant.

@jdarling
jdarling / Object.observe.poly.js
Created November 30, 2012 02:00
Initial Object.observe polyfill/shim trying to be compliant
/*
Migrated to: https://github.com/jdarling/Object.observe
Tested against Chromium build with Object.observe and acts EXACTLY the same,
though Chromium build is MUCH faster
Trying to stay as close to the spec as possible,
this is a work in progress, feel free to comment/update
http://wiki.ecmascript.org/doku.php?id=harmony:observe
@hidsh
hidsh / g
Created April 10, 2013 11:00
Yet Another Alternative to 'grep find' using mdfind(a.k.a. Spotlight) on Mac OS X
#!/bin/sh
#
# g - Yet Another Alternative to 'grep find' using mdfind(a.k.a. Spotlight) on Mac OS X
#
# usage:
# $g hoge
# $g hoge dir
USAGE="usage:\n\
\$g hoge\n\