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
Element.Storage = { | |
UID: 1 | |
}; | |
Element.addMethods({ | |
getStorage: function(element) { | |
if (!(element = $(element))) return; | |
if (Object.isUndefined(element._prototypeUID)) | |
element._prototypeUID = Element.Storage.UID++; |
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
// See comments below. | |
// This code sample and justification brought to you by | |
// Isaac Z. Schlueter, aka isaacs | |
// standard style | |
var a = "ape", | |
b = "bat", | |
c = "cat", | |
d = "dog", |
Create a tunnel to github with the git default daemon port like this:
$ ssh -L9418:github.com:9418 myuser@myhomessh.com
And clone repositories replacing github.com
with localhost
, like so:
$ git clone git://localhost/someuser/someproject.git
If you want to preserve the “correct” metadata, there are several options
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
// ==UserScript== | |
// @name jQuery For Chrome (A Cross Browser Example) | |
// @namespace jQueryForChromeExample | |
// @include * | |
// @author Erik Vergobbi Vold | |
// @description This userscript is meant to be an example on how to use jQuery in a userscript on Google Chrome. | |
// ==/UserScript== | |
// a function that loads jQuery and calls a callback function when jQuery has finished loading | |
function addJQuery(callback) { |
(a gist based on the old toolmantim article on setting up remote repos)
To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.
This is somewhat of a follow-up to the previous article setting up a new rails app with git.
Set up the new bare repo on the server:
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
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
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
// See my blog post: | |
// http://benalman.com/news/2010/09/partial-application-in-javascript/ | |
// In the following code sample, invoking the curried function will always | |
// return a function until all arguments are satisfied, at which point the | |
// original function is invoked, returning its result. This means that all | |
// function arguments are required, which also allows the function to be | |
// called either like foo( 1, 2, 3 ) or foo( 1 )( 2 )( 3 ). This also means | |
// that if any argument is omitted, the original function is never invoked. |
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
// HOWTO: load LABjs itself dynamically! | |
// inline this code in your page to load LABjs itself dynamically, if you're so inclined. | |
(function (global, oDOC, handler) { | |
var head = oDOC.head || oDOC.getElementsByTagName("head"); | |
function LABjsLoaded() { | |
// do cool stuff with $LAB here | |
} |
OlderNewer