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
| # backup current staging | |
| $ git checkout staging | |
| $ git branch tmp | |
| # reset to master and merge hotfix | |
| $ git reset --hard master | |
| $ git merge hotfix/xxx | |
| $ git push --force origin staging | |
| # deploy to production |
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
| trap('INT') { puts; exit } | |
| loop { print ">> "; puts "=> %s" % eval(gets.chomp!) } |
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
| require 'prime' | |
| class Raindrops | |
| def self.convert(number) | |
| factors = number.prime_division.to_h.keys & [3, 5, 7] | |
| return number.to_s if factors.empty? | |
| factors.join.tr('357', 'iao').gsub(/(\w)/, 'Pl\1ng') | |
| end | |
| 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
| <pre> | |
| Request to <%= servlet_request.request_uri %> | |
| Query params <%= servlet_request.query.inspect %> | |
| </pre> |
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
| class Beverage | |
| attr_reader :description | |
| def initialize() | |
| @description = "Unknown beverage" | |
| end | |
| def cost() | |
| raise NotImplementedError | |
| 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
| module Subject | |
| def register_observer() | |
| raise NotImplementedError | |
| end | |
| def remove_observer() | |
| raise NotImplementedError | |
| end | |
| def notify_observers() |
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
| class String | |
| def translate(from_str, to_str) | |
| IO.popen(["python", "-c", <<-CMD.gsub(/^\s{6}/,"")]) { |f| f.read.chomp } | |
| import string | |
| print '#{self}'.translate(string.maketrans('#{from_str}','#{to_str}')) | |
| CMD | |
| end | |
| end | |
| class Complement |
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://stackoverflow.com/questions/6594558/when-i-create-a-virtualenv-python-runs-in-64-bit-even-when-already-set-to-32-bi | |
| https://github.com/gldnspud/virtualenv-pythonw-osx/ | |
| 1 virtualenv -p /usr/local/Cellar/python/2.7.5/bin/python env | |
| 2 source env/bin/activate | |
| 3 file `which python` | |
| 4 arch -i386 python install_pythonw.py `which python`/../.. | |
| 5 file `which pythonw` | |
| 6 pip freeze | |
| 7 pip install pyglet |
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
| --- | |
| company: oozou | |
| players: | |
| - ing | |
| - jo | |
| - lhung | |
| - north | |
| - nut | |
| - phat | |
| - pon |
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
| ing | jo | 1 | |
|---|---|---|---|
| ing | lhung | 0 | |
| ing | north | 1 | |
| ing | nut | 1 | |
| ing | phat | 0 | |
| ing | pon | 1 | |
| ing | sunny | 0 | |
| jo | lhung | 0 | |
| jo | north | 1 | |
| jo | nut | -1 |