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
@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]
en:
refinery:
pages:
desktop_short_desc: Harness the power of native desktop apps.
module Kana2rom
def is_hiragana?
self.each_char do |character|
if HiraganaCharacters.include?(character) == FALSE
return false
end
end
return true
end
#! /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
@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
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 / 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
#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)
module Appname
class Application < Rails::Application
# ... various config settings
end
ISLANDS = %w(Oahu Maui Hawaii Kauai Lanai Molokai)
end
@chriskk
chriskk / new.html.erb
Created July 9, 2013 02:30
rspec error
Failures:
1) Refinery BusinessInquiries business_inquiries GET /business_inquiries/new should display the form and all fields
Failure/Error: visit refinery.new_business_inquiries_business_inquiry_path
ActionView::Template::Error:
uninitialized constant ActionView::CompiledTemplates::Appname
# /Users/chriskk/apps/appname/vendor/extensions/business_inquiries/app/views/refinery/business_inquiries/business_inquiries/new.html.erb:32:in `block (2 levels) in ___sers_chriskk_apps_appname_vendor_extensions_business_inquiries_app_views_refinery_business_inquiries_business_inquiries_new_html_erb___1273271278936162194_70175016498320'