Skip to content

Instantly share code, notes, and snippets.

View chriskk's full-sized avatar
🤙

Chris Kobayashi chriskk

🤙
  • ATTAIN
  • San Francisco, CA
View GitHub Profile
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@chriskk
chriskk / gist:5603529
Last active December 17, 2015 11:39 — forked from olistik/gist:2627011

Ubuntu 12.10 setup (RVM, PostgreSQL)

Basic pre-requisites

  • Some utilities:
sudo apt-get install vim git curl
sudo add-apt-repository ppa:webupd8team/sublime-text-2;
sudo apt-get update;
sudo apt-get install sublime-text
sudo ln -s /usr/lib/sublime-text-2/sublime_text /usr/local/bin/sublime
@chriskk
chriskk / zen_to_han.rb
Created March 28, 2013 21:28
Sample ruby code to convert from zenkaku katakana to hankaku. Reference: http://d.hatena.ne.jp/mingos/?of=32
$KCODE = 'u'
class TextFilter
@@zenkaku_kana = %w(ガ ギ グ ゲ ゴ ザ ジ ズ ゼ ゾ ダ
ヂ ヅ デ ド バ ビ ブ ベ ボ パ ピ プ ペ ポ ヴ ア イ
ウ エ オ カ キ ク ケ コ サ シ ス セ ソ タ チ
ツ テ ト ナ ニ ヌ ネ ノ ハ ヒ フ ヘ ホ マ ミ
ム メ モ ヤ ユ ヨ ラ リ ル レ
ロ ワ ヲ ン ャ ュ ョ ァ ィ ゥ ェ ォ ッ
゛ ゜ ー ! ).freeze
#! /usr/local/bin/ruby
## ymHTML - Simple HTML Parser
## (c) 2003-2011 yoshidam
## You can redistribute it and/or modify it under the same term as Ruby.
##
## Feb 11, 2011 yoshidam version 0.1.18 HTML5 style charset declaration
## Mar 3, 2009 yoshidam version 0.1.16 parseDTD bug fix
## Aug 6, 2009 yoshidam version 0.1.15 encoding bug fix
## Aug 1, 2009 yoshidam version 0.1.14 Ruby 1.9
module Kana2rom
def is_hiragana?
self.each_char do |character|
if HiraganaCharacters.include?(character) == FALSE
return false
end
end
return true
end
en:
refinery:
pages:
desktop_short_desc: Harness the power of native desktop apps.
@chriskk
chriskk / memcache.rb
Created July 24, 2012 08:55 — forked from bkimble/gist:1365005
Command line tool to list memcache keys and to get the value of a specific key
#!/usr/bin/env ruby
require 'net/telnet'
require 'lib/trollop'
opts = Trollop::options do
banner <<-EOS
Command line tool to list memcache keys and to get the value of a specific key
Usage:
memcache [options]