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
#!/bin/bash | |
#Change OSX Wifi settings to use socks proxy | |
sudo networksetup -setsocksfirewallproxy "Wi-Fi" localhost 2000 | |
#Setup a socks proxy over ssh to a server (will ask for password and block further execution untill connection is closed) | |
ssh -N -g -D 2000 [email protected] | |
#Stop using OSX Wifi proxy | |
sudo networksetup -setsocksfirewallproxystate "Wi-Fi" off |
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
var foo = | |
{ | |
get | |
{ | |
return 10 | |
} | |
set | |
{ | |
foo = newValue | |
} |
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
/** | |
* Helper for delaying certain callbacks | |
* @param callback | |
* @param delay | |
* @constructor | |
*/ | |
define('Delay', [], function() | |
{ | |
return function(callback, delay) |
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
// Ruby like regular expression matching | |
infix operator =~ {} | |
func =~ (input: String, pattern: String) -> Bool | |
{ | |
return input.rangeOfString(pattern, options: .RegularExpressionSearch) != nil | |
} | |
// Example | |
if "foobaar" =~ "[a-z]*" | |
{ |
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
<?php | |
/* A quick emulator for common curl function so code based on CURL works on AppEngine */ | |
if(!function_exists('curl_init')) | |
{ | |
// The curl option constants, when there is no curl they are not defined so we define them here | |
// Some options don't do anything, they just prefent crashes when they are here (see the setOpt method for the support of different options) | |
define('CURLOPT_RETURNTRANSFER', 'CURLOPT_RETURNTRANSFER'); | |
define('CURLOPT_SSL_VERIFYPEER', 'CURLOPT_SSL_VERIFYPEER'); |