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
#!/bin/sh | |
CURRENT=$(node -v) | |
#version details | |
VERSION=$(curl -L -s http://nodejs.org/dist/latest/ \ | |
| egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \ | |
| tail -n1) | |
PLATFORM=linux | |
ARCH=x64 |
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
NSString *strArrayExample = @"%5B%22hello%22%2C%22world!%22%2C12%5D"; | |
NSString *strObjectExample = @"%7B%22a%22%3A%221%22%2C%22b%22%3A%22c%22%7D"; | |
NSString *str = [strArrayExample stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
NSLog(@"str:: %@", str); | |
NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding]; | |
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; | |
NSLog(@"type of data:: %@", NSStringFromClass([json class])); |
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
// http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle | |
$.fn.scramble = function() { | |
var i = this.length; | |
if (i > 0) { | |
var j; | |
var tmp; | |
while (--i) { | |
j = Math.floor(Math.random() * (i + 1)); | |
t = this[j]; | |
this[j] = this[i]; |
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
// don't forget to set &oauth=1 in FB.init | |
// check for valid login, the easy way: | |
if (FB._authResponse != null) | |
FB.login(function(r) {}, {scope: 'user_photos'}) | |
FB.api('/me/albums', function(d) { | |
for (var i=0; i<d.data.length; i++) { | |
console.log(d.data[i].id, d.data[i].name, d.data[i].link); |
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
cd /tmp | |
git clone git://gist.github.com/946648.git | |
cd git | |
git checkout git-completion.bash | |
cp git-completion.bash ~/.git-completion.bash | |
cd ~ | |
rm -rf /tmp/git | |
echo -e "source ~/.git-completion.bash" >> .bash_profile |
NewerOlder