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
def brain | |
@brain ||= CalculatorBrain.new | |
end |
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
## 사용법 | |
## 카미나리 | |
## 오이짜응 | |
## 제이쿼리 | |
## Thor | |
## Ap |
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
<%= new_post_path(:foo=>"&&<?> ' == nil",:bar => 2) %> | |
/posts/new?bar=2&foo=%26%26%3C%3F%3E+%27+%3D%3D+nil | |
<%= raw new_post_path(:foo=>"&&<?> ' == nil",:bar => 2) %> | |
/posts/new?bar=2&foo=%26%26%3C%3F%3E+%27+%3D%3D+ni |
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
git branch new_master | |
git checkout new_master | |
git branch -m master old_master | |
git branch -m new_master master | |
git branch -D old_master |
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
// Bad no-caching | |
$('#some-element').css({ 'background-color': '#FF0000' }); | |
$('#some-element').html("I turned red"); | |
// Good caching | |
var some_element = $('#some-element'); | |
some_element.css({ 'background-color': '#FF0000' }); | |
some_element.html("I turned red"); |
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
when type | |
case 1 | |
Comment.all.length | |
case 2 | |
@comments = @post.comments.all | |
@comments.length | |
case 3 | |
@post.comments.length | |
end | |
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
for i in $(cat .gitmodules|grep path\\b|sed 's/path = //') | |
do cd $i | |
git checkout master | |
git pull | |
1 | |
done |
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
var ctx = { rate : 3 }; | |
var sum = (new Function("rate", "a", "b", "return (a + b)*rate;")).bind(this,ctx.rate); | |
console.log( sum( 5, 7 ) ); // 36 출력 |
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://cjohansen.no/en/ruby/twibot_a_microframework_for_twitter_bots_in_ruby | |
require 'twibot' | |
{"keyword1"=> "message1", | |
"keyword2"=> "message2", | |
"keyword3"=> "message3", | |
"keyword4"=> "message4", | |
"keyword5"=> "message5", | |
"keyword6"=> "message6", |
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
//다른 오브젝트의 함수를 끌어다 쓸수있었네. | |
var cat, dog, setName; | |
setName = function(name) { | |
return this.name = name; | |
}; | |
cat = {}; | |
cat.setName = setName; | |
dog = {}; | |
cat.setName.apply(dog, ['yani']); | |
console.log(dog.name); //yani |