Skip to content

Instantly share code, notes, and snippets.

View ihower's full-sized avatar
🎯
Focusing

Wen-Tien Chang ihower

🎯
Focusing
View GitHub Profile
@ihower
ihower / det4
Created November 30, 2010 15:10
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int n, i, j, ii, jj, row, col, result=0;
int a[100][100];
int b[10][10];
printf("Input N = ");
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "("${ref#refs/heads/}") ";
}
PS1="[\[\033[1;32m\]\w\[\033[0m] \[\033[0m\]\[\033[1;36m\]\$(parse_git_branch)\[\033[0m\]$ "
if [[ -s /Users/ihower/.rvm/scripts/rvm ]] ; then source /Users/ihower/.rvm/scripts/rvm ; fi
@ihower
ihower / gist:795186
Created January 25, 2011 16:44
~/Library/Application Support/Propane/styles/cf_chat.css
tbody#chat div, tbody#chat span {
font-size: 1.2em ! important;
}
tr.timestamp_message + tr.timestamp_message,
tr.leave_message + tr.timestamp_message,
tr.enter_message + tr.timestamp_message,
tr.kick_message + tr.timestamp_message,
tr.enter_message, tr.kick_message, tr.leave_message {
display: none !important;
#!/bin/sh
user_email=$(git config --get user.email)
if [ "$user_email" == "[email protected]" ]
then
echo "ERROR: Please setup git pair authors!"
exit 1
fi
function git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "("${ref#refs/heads/}") ";
}
function git_since_last_commit {
now=`date +%s`;
last_commit=$(git log --pretty=format:%at -1 2> /dev/null) || return;
seconds_since_last_commit=$((now-last_commit));
minutes_since_last_commit=$((seconds_since_last_commit/60));
require 'rubygems'
require 'nokogiri'
require 'fastercsv'
doc = Nokogiri::HTML( File.read("timesheet.txt") )
memo = {}
elapsed = {}
doc.css('div').each do |div|
if div.attributes["class"].value =~ /(.*)-memo$/
@ihower
ihower / gist:940088
Created April 25, 2011 02:39
parsing XML chunk by chunk
# <xml version="1.0" encoding="UTF-8">
# <DataFeeds>
# <Item>
# ....
# </Item>
# <Item>
# ...
# </Item>
# </DataFeeds>
class Fixnum
alias_method :old_to_s, :to_s
def to_s
old_to_s
end
end
desc 'Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile, test:plugins)'
task :test do
tests_to_run = ENV['TEST'] ? ["test:single"] : %w(test:units test:functionals test:integration)
errors = tests_to_run.collect do |task|
begin
Rake::Task[task].invoke
nil
rescue => e
{ :task => task, :exception => e }
end