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
require "nokogiri" | |
require "uri" | |
require "net/http" | |
UA = "Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/18.0 Firefox/18.0 FirePHP/0.7.1" | |
@cookie = {} | |
def request(address, method = :get, data = {}) | |
uri = URI.parse(address) | |
http = Net::HTTP.new(uri.host, uri.port) |
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
# initializers/savon.rb | |
# Savon Global configuration | |
Savon.configure do |config| | |
config.log = true | |
config.log_level = :debug | |
config.logger = Rails.logger | |
config.env_namespace = :soapenv | |
end |
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
@mixin active($selector) { | |
#{$selector} { | |
color:black; | |
} | |
} | |
#my-id { | |
@include active($selector: ".my-class") | |
} |
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
/* | |
* TL;DR => Safari Select Box onchange Event Bug Fix | |
* Problem: | |
On keyboard event of select box (like searching for desired options), | |
safari doesn't fire the event even hitting enter key. Instead, it fires | |
the change event on again hitting enter key or clicking anywhere, | |
so as we can get the selected option's value. Same happen when clicking | |
on desired option. This is weird. | |
*/ | |
if(navigator.userAgent.match(/safari/i)){ |
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 module = {}; | |
(function(exports){ | |
exports.notGlobalFunction = function() { | |
console.log('I am not global'); | |
}; | |
}(module)); | |
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 myFunc = function(arg1, arg2) { | |
console.log(this, arg1, arg2); // guess what is `this` ! | |
}; | |
var newObject = {}; | |
myFunc('foo', 'bar'); //outputs: Window "foo" "bar" | |
// .call takes unlimited number of arguments, and passes first argument as | |
// `this` (i.e. first parameter) and rest arguments as second parameter |
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
// npm install rem read | |
var rem = require('rem'), | |
fs = require('fs'), | |
read = require('read'); | |
var tw = rem.connect('twitter.com', '1.1'), | |
oauth = rem.oauth(tw); | |
// Add whichever API keys you want to test here. | |
// Including the iPhone/Android apps, these keys are configured as "desktop" |
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 1 | |
mediator.name = 'Doug'; | |
mediator.subscribe('nameChange', function(arg) { | |
console.log(this.name); | |
this.name = arg; | |
console.log(this.name); | |
}); | |
mediator.publish('nameChange', 'Jorn'); |
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
# Make and cd into directory | |
mcd() { | |
mkdir -p "$1" && cd "$1"; | |
} | |
# Find text in any file | |
ft() { | |
find . -name "$2" -exec grep -il "$1" {} \; | |
} |
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
|9| |97| |108| |115| |0| | |
^ | |
V i s NULL | |
a h | |
l | |
++++++++++[>+++++++++>+++++++++++>++++++++++++<<<-]>----.>-----.>-----.<-.<+++++++++++.>++++.>>. | |
V i s h a l |