Skip to content

Instantly share code, notes, and snippets.

View hc5duke's full-sized avatar

Hwan-Joon Choi hc5duke

View GitHub Profile
@hc5duke
hc5duke / git_info.bash
Created January 11, 2012 08:49
Git info in PS1
git_info() {
# colors
local RESET="\033[0m"
local GRAY="\033[1;30m"
local RED="\033[1;31m"
local GREEN="\033[1;32m"
local BLUE="\033[1;34m"
local PINK="\033[1;35m"
local CYAN="\033[1;36m"
@hc5duke
hc5duke / 아래아-bookmarklet.js
Last active July 31, 2020 18:10
render 아래아 properly on jemin.com, based on jamocomposed_block class in https://ko.wikipedia.org/wiki/%E3%86%8D
javascript:(function(){var s = document.createElement('style');s.appendChild(document.createTextNode('*{font-family:"본고딕","Source Han Sans K","본고딕 KR","Source Han Sans KR","思源黑體","Source Han Sans TC","思源黑體 香港","Source Han Sans HC","思源黑体","Source Han Sans SC","源ノ角ゴシック","Source Han Sans","본명조","Source Han Serif K","본명조 KR","Source Han Serif KR","思源宋體","Source Han Serif TC","思源宋體 香港","Source Han Serif HC","思源宋体","Source Han Serif SC","源ノ明朝","Source Han Serif","Noto Sans CJK KR","Noto Sans KR","Noto Sans CJK TC","Noto Sans CJK HC","Noto Sans CJK SC","Noto Sans CJK JP","Noto Serif CJK KR","Noto Serif KR","Noto Serif CJK TC","Noto Serif CJK SC","Noto Serif CJK JP","나눔바른고딕 옛한글","NanumBarunGothic YetHangul","나눔명조 옛한글","NanumMyeongjo YetHangul","함초롬돋움 LVT","HCR Dotum LVT","함초롬바탕 LVT","HCR Batang LVT","은 바탕","Un Batang","돋움 옛한글","Dotum Old Hangul","바탕 옛한글","Batang Old Hangul","굴림 옛한글","NewGulim Old Hangul","궁서 옛한글","Gungsuh Old Hangul","맑은 고딕","Malgun Gothic","함초롬돋움","HCR Dotum","함초롬바탕","HCR Batang" !important;}'));doc
11/14 BOSTON UNIVERSITY * 39 7-14 0-3 5-7 0-0 0 2 2 1 0 1 19
11/16 SETON HALL * 27 6-11 4-7 2-2 0-4 4 1 1 3 0 0 18
11/19 DAVIDSON * 36 10-18 4-6 5-5 0-0 0 0 1 2 0 1 29
11/23 vs. Drexel * 37 8-19 2-8 13-15 0-2 2 2 1 1 0 2 31
11/25 vs. Memphis * 36 4-9 3-3 4-5 0-2 2 2 3 3 0 1 15
11/30 at Indiana * 40 10-17 4-8 5-6 1-3 4 1 5 4 0 2 29
12/4 VIRGINIA TECH * 34 6-19 2-8 4-4 0-0 0 3 2 4 0 1 18
12/7 PENNSYLVANIA * 37 8-16 4-9 4-4 0-2 2 1 4 1 0 0 24
12/10 vs. Texas * 37 13-24 9-16 6-6 1-3 4 1 0 1 0 3 41
12/18 VALPARAISO * 33 9-15 5-9 7-9 0-1 1 1 1 1 0 2 30
@hc5duke
hc5duke / circle.yml
Created March 24, 2013 06:24
Using Karma/Testacular with CircleCI
test:
pre:
- npm install -g karma
- nohup bash -c "karma start spec/javascripts/testacular.conf.js &"
override:
- bundle exec rspec spec
- karma run
@hc5duke
hc5duke / hash_default.rb
Created December 15, 2012 01:05
hash defaults don't work like that.
> a = {}
# => {}
> a.default = []
# => []
> a[:b]
# => []
> a[:b] << 3
# => [3]
> a
# => {}
@hc5duke
hc5duke / pre-commit
Created November 2, 2012 18:32
pre-commit hook
#!/usr/bin/env ruby
# copy or symlink this file to .git/hooks/
# automatically strip spaces from the end of lines and add newlines to the end of files as necessary
filetypes = %w(
builder
conf
css
erb
haml
@hc5duke
hc5duke / delegation2.rb
Created October 8, 2012 08:11
sort of kind of delegate
class SubCity < ActiveRecord::Base
belongs_to :city
delegate :map, to: :sub_cities, prefix: true
end
# later
city.sub_cities_map(&:name)
@hc5duke
hc5duke / delegations.rb
Created October 8, 2012 07:02
delegations
delegate :names, to: :sub_cities, prefix: true
# undefined method `names' for #<ActiveRecord::Relation>
delegate :name, to: :sub_cities, prefix: true
# => "SubCity"
delegate :name, to: :sub_city, prefix: true
delegate :names, to: :sub_city, prefix: true
# undefined local variable or method `sub_city' for #<City>
@hc5duke
hc5duke / city.rb
Created October 8, 2012 07:00
city and sub_cities
# sub_city.rb
class SubCity < ActiveRecord::Base
belongs_to :city
def sub_cities_names
sub_cities.map(&:name)
end
end
# city.rb
class City < ActiveRecord::Base
@hc5duke
hc5duke / parent.html
Created September 17, 2012 04:16
Four Seasons html injection
<html>
<head>
<meta http-equiv="Expires" content="Mon, 01 Jan 1900 00:00:00 GMT">
<meta http-equiv="Pragma" content="no-cache">
<script type='text/javascript'>
<!--
if (window.parent != window) {
document.location = "http://mail.tapjoy.com/";
}
//-->