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
# plain ruby | |
def secure_compare(a, b) | |
return false if a.empty? || b.empty? || a.bytesize != b.bytesize | |
l = a.unpack "C#{a.bytesize}" | |
res = 0 | |
b.each_byte { |byte| res |= byte ^ l.shift } | |
res == 0 |
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
class Validator {} | |
var global = window || global; | |
global.Validator = Validator; |
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
[user] | |
name = <yourname> | |
email = <youre email> | |
[alias] | |
co = checkout | |
unpushed = diff origin/master..HEAD --name-status | |
rpo = remote prune origin | |
notmerged = branch --no-merged | |
merged = branch --merged | |
[color] |
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
for f in huk/*.*; do mv "$f" ./; done |
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
Pry Cheat Sheet | |
Youtube Tutorial 2013 | |
Command Line | |
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru) | |
pry -r ./config/environment.rb - load your rails into a pry session | |
Debugger | |
help ls -- Display command options for pry command ls | |
ls <Object> -- Show all of the available methods that can be called by an object |
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
Pry Cheat Sheet | |
Youtube Tutorial 2013 | |
Command Line | |
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru) | |
pry -r ./config/environment.rb - load your rails into a pry session | |
Debugger | |
help ls -- Display command options for pry command ls | |
ls <Object> -- Show all of the available methods that can be called by an object |
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
lsof -nP -iTCP:3000 | grep LISTEN |
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
docker ps | |
# running docker container | |
docker stop <contaienrId> | |
# stop the container | |
docker images | |
# list all installed images | |
# Start containers ========================================== | |
# REDIS | |
docker run -it --rm -p 6379:6379 -d --name redis redis:alpine |
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
docker ps | |
# running docker container | |
docker stop <contaienrId> | |
# stop the container | |
docker images | |
# list all installed images | |
# Start containers ========================================== | |
# REDIS | |
docker run -it --rm -p 6379:6379 -d --name redis redis:alpine |
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
class PropertyStruct | |
def initialize(nil_safe = true) | |
@nil_safe = !!nil_safe | |
@data = {} | |
end | |
def [](attribute) | |
result = @data |
NewerOlder