Skip to content

Instantly share code, notes, and snippets.

View muddylemon's full-sized avatar

Lance Kidwell muddylemon

View GitHub Profile
@os0x
os0x / dollarX.js
Created November 27, 2008 04:17 — forked from cho45/dollarX.js
very simple $X
// very simple version of $X
// $X(exp);
// $X(exp, context, resolver, XPathResult.NUMBER_TYPE).numberValue;
// @source https:/raw.github.com/gist/29681
function $X (exp, context, resolver, result_type) {
context || (context = document);
var Doc = context.ownerDocument || context;
var result = Doc.evaluate(exp, context, resolver, result_type || XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
if (result_type) return result;
for (var i = 0, len = result.snapshotLength, res = new Array(len); i < len; i++) {
var webviewProvider = (function() {
if (/\/FBIOS/i.test(navigator.userAgent) === true) {
return 'facebook';
}
if (/Twitter for/i.test(navigator.userAgent) === true) {
return 'twitter';
}
if (/Pinterest\//.test(navigator.userAgent) === true) {
return 'pinterest';
}
@digitaljhelms
digitaljhelms / gist:3014302
Created June 28, 2012 22:08
Sublime Text 2 bash alias & CLI function to open projects without using the `.sublime-project` file extension
# bash alias
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
# bash function, usage: $ st -p [projectname] -opt2 -opt3
function st() {
if [ -n "$1" -a -n "$2" ]; then # if more than one argument
if [ "$1" = "-p" -o "$1" = "--project" ]; then # if arg1 is -p or --project
local projectfile="$2"
[[ $projectfile != *.sublime-project ]] && projectfile="$2.sublime-project" # detect if arg2 already includes the ext
if [ -e $projectfile ]; then # does project file exist?
@muddylemon
muddylemon / .bash_history
Created March 10, 2013 07:08
This is my bash history file on every machine I have
pwd
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
chsh -s /bin/zsh
exit
@ryndel
ryndel / handlebars.linkify.js
Created October 14, 2012 01:17
Handlebars.js: linkify helper #cc #handlebars
Handlebars.registerHelper('linkify', function (text) {
text = text.replace(/(https?:\/\/\S+)/gi, function (s) {
return '<a href="' + s + '">' + s + '</a>';
});
text = text.replace(/(^|)@(\w+)/gi, function (s) {
return '<a href="http://twitter.com/' + s + '">' + s + '</a>';
});
text = text.replace(/(^|)#(\w+)/gi, function (s) {
@vlandham
vlandham / geodesic.js
Created October 12, 2012 15:50 — forked from mbostock/.block
Geodesic Grid
(function() {
var φ = 1.618033988749895,
ρ = 180 / Math.PI;
var vertices = [
[1,φ,0], [-1,φ,0], [1,-φ,0], [-1,-φ,0],
[0,1,φ], [0,-1,φ], [0,1,-φ], [0,-1,-φ],
[φ,0,1], [-φ,0,1], [φ,0,-1], [-φ,0,-1]
];