sudo ln -s /opt/X11 /usr/X11
This file contains 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($) { | |
var add = $.event.add; | |
$.event.add = function() { | |
var elem = arguments[0], | |
types = arguments[1]; | |
if ( !types || !elem ) return add.apply(this, arguments); | |
types = (types || "").match(/\S+/g) || []; | |
var events = $._data(elem).events; | |
if ( events && types.length ) { | |
$.each(types, function(i, type) { |
This file contains 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
iframe.attachEvent && iframe.attachEvent("onload", onload); | |
iframe.onload = onload; |
This file contains 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
xcode-select --install |
This file contains 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
// Test if a number is Prime using a simple regex. | |
// Demo: http://jsfiddle.net/rJhpq/ | |
function prime(n) { | |
return !/^1?$|^(11+?)\1+$/.test((function(n){s='';while(n--)s+='1';return s;}(n))); | |
} | |
|
This file contains 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
/* Test if the browser supports decimal letterspacing for fine kerning (f.ex 0.5px) | |
* At the moment (january 2012), at least webkit (chrome & safari) does not render decimal pixels correctly | |
* https://bugs.webkit.org/show_bug.cgi?id=20606 | |
* Using this method, you can at least provide an alternative kerning for those browsers | |
*/ | |
var letterspacing = (function(d) { | |
var test = d.createElement('div'), | |
ret = true; | |
test.style.letterSpacing = '.5px'; |
This file contains 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 n(f) { | |
return f.replace(/</g,"<").replace(/>/g,">"); | |
} | |
a = document.activeElement; | |
v = a.value; | |
s = a.selectionStart; | |
e = a.selectionEnd; | |
a.value = v.substr(0,s) + n(v.substr(s,e)) + v.substr(e,v.length); | |
/* |
sudo mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/
vi /usr/local/Library/brew.rb
Change line 1 from:
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
to:
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0
Save and exit
This file contains 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
// example: | |
// var stateHandler = State(node, function(state) { this.className = state.active ? 'active' : '' }) | |
// stateHandler.set({ active: true }) | |
var states = {} | |
function State(elem, render) { | |
if ( states.hasOwnProperty(elem) ) | |
return states[elem] | |
if ( !(this instanceof State) ) { | |
var instance = new State(elem, render) |