Skip to content

Instantly share code, notes, and snippets.

View jhsu's full-sized avatar
💀
compliant with future standards

Joe Hsu jhsu

💀
compliant with future standards
  • MineHub
  • New York, NY
  • X @jhsu
View GitHub Profile
@jhsu
jhsu / Heartpts
Created August 18, 2008 03:49
Heartpts description for fbFund
purpose
=======
Heartpts is the point system of love. It provides a fun way for a couple to keep the score and provide a channel for better communication.
application information
=======================
Heartpts allows someone in a relationship to give or subtract points from his/her partner and provide a reason. The visible number of points adds a fun competitive element to communication in a relationship.
In the future, I see Heartpts providing goals that couples can set up and try to obtain by trying to improve their relationship. These goals may be coupled with things such as a movie date or dinner with which I would want to provide some sort of discount for users.
# download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"
exit!
// ==UserScript==
// @name Lighthouse theme for Trac
// @namespace http://philwilson.org
// @description Lighthouse theme for Trac
// @include http://www.viralogy.com:8000/*
#!/usr/bin/env ruby
#
# A hook script to verify that only syntactically valid ruby code is commited.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# Put this code into a file called "pre-commit" inside your .git/hooks
# directory, and make sure it is executable ("chmod +x .git/hooks/pre-commit")
#
@jhsu
jhsu / gist:168401
Created August 15, 2009 17:02
Bash script to set up Ubuntu after fresh install
#!/bin/bash
sudo apt-get install build-essentials openssh postgresql curl xsel
sudo apt-get install nginx php5 mysql-server libmysqlclient15-dev \
ruby1.8-dev libopenssl-ruby libopenssl-ruby1.8 libmysql-ruby \
libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libreadline-ruby1.8 \
ruby irb ri git-core
sudo aptitude install gnome-desktop-environment awesome
Factory.define :event_pool do |p|
p.name "Some event pool"
end
SELECT gid, name FROM group WHERE gid IN (SELECT gid FROM group_member WHERE uid = 15712790)
@jhsu
jhsu / 1.application
Created November 13, 2009 01:50
Easy Paritals Sinatra
# from: http://smellsblue.blogspot.com/2009/11/easy-partials-in-rails.html
helpers do
def method_missing(method_name, *args, &block)
method_str = method_name.to_s
if method_str =~ /^_.+$/
options = {}
options.merge!(args.first) unless args.empty?
haml method_name, locals => options, :layout => false
else
startup_message off
autodetach on
# caption always "%?%{+b kw}%-Lw%?%{yK}%n*%f %t%?(%u)%?%?%{wk}%+Lw%? %{gk}%=%c %{yk}%d/%M/%Y"
hardstatus alwayslastline
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n*%f %t%{= kG}%+Lw%< %{= kG}%-=%D %m/%d/%y | %C:%s %A | %1`%{-}'
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
@jhsu
jhsu / UsefulCucumber.rb
Created November 15, 2009 03:04
Useful Cucumber
# Open page for debugging (needs 'launchy' gem)
# from http://openmonkey.com/articles/2009/08/show-me-the-page
Then /^show me the page$/ do
save_and_open_page
end