This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
repo = `basename \`git rev-parse --show-toplevel\``.strip | |
sha = `git rev-parse HEAD`.strip | |
file= "~/Dropbox/Code/gitshots/#{Time.now.to_i}-#{repo}-#{sha}.jpg" | |
puts "Taking capture into #{file}!"; | |
system "imagesnap -q -w 3 #{file} &"; | |
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function random-mac() { | |
local interface="${1:-en0}" | |
local old_addr=`ifconfig $interface |grep ether|awk '{print $2}'` | |
local new_addr=`ruby -e "puts ('%02x' % ((rand 64)*4|2))+(0..4).inject('') {|s,x| s + ':%02x' %(rand 256)}"` | |
`sudo ifconfig $interface ether $new_addr` | |
if [ $? -eq 0 ]; then | |
echo "Switched mac address on $interface to $new_addr from $old_addr" | |
else | |
echo "FAILED TO SWITCH MAC ADDRRESS ON $interface" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Bencoding.h | |
// bencoder | |
// | |
// Created by Thomas Rix on 7/21/12. | |
// Copyright (c) 2012 Thomas Rix. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Zepto.js | |
// (c) 2010, 2011 Thomas Fuchs | |
// Zepto.js may be freely distributed under the MIT license. | |
(function(a){String.prototype.trim===a&&(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}),Array.prototype.reduce===a&&(Array.prototype.reduce=function(b){if(this===void 0||this===null)throw new TypeError;var c=Object(this),d=c.length>>>0,e=0,f;if(typeof b!="function")throw new TypeError;if(d==0&&arguments.length==1)throw new TypeError;if(arguments.length>=2)f=arguments[1];else do{if(e in c){f=c[e++];break}if(++e>=d)throw new TypeError}while(!0);while(e<d)e in c&&(f=b.call(a,f,c[e],e,c)),e++;return f})})();var Zepto=function(){function v(a){return{}.toString.call(a)=="[object Function]"}function w(a){return a instanceof Object}function x(a){return a instanceof Array}function y(a){return typeof a.length=="number"}function z(b){return b.filter(function(b){return b!==a&&b!==null})}function A(a){return a.length>0?[].concat.apply([],a):a}function B(a){return a.repla |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a template bookmarklet that loads jQuery. Also works | |
* if another library has defined $ itself. | |
*/ | |
(function () { | |
var s = document.createElement('script'); | |
s.setAttribute('src', 'http://jquery.com/src/jquery-latest.js'); | |
s.onload = function () { | |
jQuery.noConflict(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fetch = (function () { | |
var scriptStatus = {}, | |
callbackStack = [], | |
STATUS_LOADING = 1, | |
STATUS_LOADED = 2; | |
function requestScript(url) { | |
if (typeof(scriptStatus[url]) === 'undefined') { | |
var scriptTag = document.createElement('script'); | |
scriptTag.type = 'text/javascript'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cache element clicks | |
(function () { | |
var eventTypes = ['click'], | |
eventStack = [], | |
handler = function(event) { | |
document.getElementById('debug').innerHTML += "Caching event\n"; | |
eventStack.push(event); | |
}; | |
eventTypes.forEach(function (eventType) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (win, doc) { | |
var by = {}, | |
slice = [].slice, | |
type2method = { | |
id: "getElementById", | |
className: "getElementsByClassName", | |
tagName: "getElementsByTagName", | |
query: "querySelectorAll" | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var C = twttr.constants.noob; | |
B = B || twttr.currentUser; | |
if (B && twttr.decider.isAvailable("flock")) { | |
if (B.statusesCount == 0) { | |
if (B.followersCount > 49) { | |
return C.notNoob | |
} | |
if (B.friendsCount === 0) { | |
return (B.followersCount ? C.invited : C.total) | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var meryl = require('./vendor/meryl'); | |
meryl.h('GET /hello/{a}/{b}/{c}', function () { | |
this.send(this.params.a + this.params.b + this.params.c); | |
}); | |
require('http').createServer(meryl.cgi()).listen(3000); | |