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
View GitHub Profile
class FizzBuzz
def self.run
# your solution goes here
# use "puts" to print out a number, "fizz", or "buzz"
(1..100).each do |n|
output = ""
output += "Fizz" if (n%3).zero?
output += "Buzz" if (n%5).zero?
puts output.empty? ? n : output
end
puts $$
children = []
list = [1,2]
list.each do |i|
pid = fork {
puts i
loop do
print '.'
sleep 0.5
end
/*
Errno::ENOENT: No such file or directory - getcwd
Backtrace:
/home/webadmit/.rvm/gems/ruby-1.9.2-p290@webadmit/gems/sass-3.1.7/lib/sass/importers/filesystem.rb:16:in `expand_path'
/home/webadmit/.rvm/gems/ruby-1.9.2-p290@webadmit/gems/sass-3.1.7/lib/sass/importers/filesystem.rb:16:in `initialize'
/home/webadmit/.rvm/gems/ruby-1.9.2-p290@webadmit/gems/sass-3.1.7/lib/sass/engine.rb:153:in `new'
/home/webadmit/.rvm/gems/ruby-1.9.2-p290@webadmit/gems/sass-3.1.7/lib/sass/engine.rb:153:in `normalize_options'
/home/webadmit/.rvm/gems/ruby-1.9.2-p290@webadmit/gems/sass-3.1.7/lib/sass/engine.rb:228:in `initialize'
/home/webadmit/.rvm/gems/ruby-1.9.2-p290@webadmit/gems/sass-3.1.7/lib/sass/engine.rb:201:in `new'
#!/usr/bin/env bash
git reset --soft HEAD~1
@jhsu
jhsu / mkick.rb
Created September 26, 2011 19:15
# mkick.rb
#
# Mass-kicks users in a channel
#
# http://scripts.irssi.org/html/mkick.pl.html
#
# Possible inspiration: http://weechat.org/files/scripts/unofficial/chanlist.rb
#
# Usage: /mkick <channel> <kick message>
# Maintainer: Joseph Hsu <jhsu.x1@gmail.com>
pkgname=bdsm-git
pkgver=20110418
pkgrel=1
pkgdesc="SM :: S{cripting,ystem,tack} Management (SM) Framework (Core)"
arch=('i686' 'x86_64')
url="https://sm.beginrescueend.com/"
license=("Apache License, Version 2.0")
depends=("bash")
makedepends=("git")
@jhsu
jhsu / .rvmrc
Created August 30, 2011 23:29
UB Open courses checker (HUB Student Center)
rvm use 1.8.7
flip: (╯°□°)╯︵ ┻━┻
ruby-1.9.2-p180 :019 > CSV.parse("this is some,b0rken \"csv\"")
#=> CSV::MalformedCSVError: Illegal quoting on line 1.
module PluginHelper
module ClassMethods
attr_accessor :commands
def user_commands(*cmds)
@commands = cmds
end
end
def self.included(base)
base.extend(ClassMethods)