Skip to content

Instantly share code, notes, and snippets.

View hc5duke's full-sized avatar

Hwan-Joon Choi hc5duke

View GitHub Profile
@hc5duke
hc5duke / bart_sked.rhtml
Created May 25, 2009 02:57
bart schedule for pleasanton-embarcadero, using ruby on apache
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>Bart</title>
<style type="text/css" media="screen">
div {max-width:300px;}
div.destination {font-size:24px;font-weight:bold;border:2px solid #00c;text-align:center;margin:0px -2px;}
div.estimates {padding-bottom:15px;}
@hc5duke
hc5duke / homework.rb
Created June 30, 2009 07:15 — forked from visnup/homework.rb
I copied visnup!
require 'rubygems'
require 'open-uri'
require 'json'
url = 'http://twitter.com/statuses/user_timeline.json?id=hc5duke&count=3200'
dates = open(url) { |f| JSON.parse f.read }.map { |e| Time.parse e['created_at'] }
sum = dates.inject(Hash.new(0)) { |s, t| s[t.strftime('%Y-%m-%d')] += 1; s }
total = 0
sum.keys.sort.each { |k| puts "#{k}\t#{sum[k]}\t#{total += sum[k]}" }
// hide status bar
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[application setStatusBarHidden:TRUE];
[window addSubview:controller.view];
[window makeKeyAndVisible];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"touch!");
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>Bart</title>
<style type="text/css" media="screen">
div {max-width:300px;}
div.destination {font-size:24px;font-weight:bold;border:2px solid #00c;text-align:center;margin:0px -2px;}
div.estimates {padding-bottom:15px;}
@hc5duke
hc5duke / .profile
Created July 22, 2009 09:28
copied visnup and alc
#!/bin/bash
# based heavily on termwide prompt by Giles - created 2 November 98
# http://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-12.html
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/Users/hchoi/dev/android-sdk-mac_x86-1.1_r1/tools:$PATH
export DISPLAY=:0.0
export EDITOR=vi
function prompt_command {
local fillsize
require 'rubygems'
require 'open-uri'
require 'json'
swivelers = ['badave', 'burnto', 'bmulloy', 'bwalsh', 'gerad', 'hc5duke', 'huned', 'kalendae', 'nataliegrae', 'quanghiem', 'teamswivel', 'visnup'].sort
debug = true
mode = 'total' # or 'daily' or 'weekly'
daily = {}
# grab files first
tell application "GrowlHelperApp"
set the allNotificationsList to {"Debug"}
set the enabledNotificationsList to {"Debug"}
register as application ¬
"AppleScript Growl" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Script Editor"
end tell
$ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
# Star Trek
(doc/"table.wikitable"/"tr").select{|tr| (tr/"td").count > 2}.map{|tr| (tr/"td").select{|td| !td.nil? && td.inner_html.match(/\"/)}.first.inner_html.gsub(/<\/?[^>]*>/, "").gsub(/\"/, "").gsub("&#160;"," ") }[7..-1]