This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'i18n_generators' | |
group :development, :test do | |
gem 'capybara' | |
gem 'rspec-rails' | |
gem 'spork' | |
gem 'watchr' | |
gem 'factory_girl_rails' | |
gem 'timecop' | |
gem 'fuubar' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static VALUE | |
rb_str_each_line(int argc, VALUE *argv, VALUE str) | |
{ | |
rb_encoding *enc; | |
VALUE rs; | |
unsigned int newline; | |
const char *p, *pend, *s, *ptr; | |
long len, rslen; | |
VALUE line; | |
int n; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem: --no-ri --no-rdoc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Kozaki, Tsuneaki | |
email = [email protected] | |
[color] | |
ui = auto | |
[core] | |
quotepath = false | |
editor = emacsclient | |
autocrlf = false | |
[alias] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if @user.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= t(:header, :model => t(:user, :scope => [:activerecord, :models]), | |
:count => @user.errors.count, :scope => [:activerecord, :errors, :template]) %></h2> | |
<p><%= t(:body, :scope => [:activerecord, :errors, :template]) %></p> | |
<ul> | |
<% @user.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'irb/completion' | |
require 'pp' | |
IRB.conf[:AUTO_INDENT] = true | |
IRB.conf[:PROMPT][:CUSTUME] = { | |
:PROMPT_I => "%03n:>> ", | |
:PROMPT_N => "%03n:%i>", | |
:PROMPT_S => "%03n:>%l ", | |
:PROMPT_C => "%03n:>> ", | |
:RETURN => "=> %s\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def notify(title, message, image) | |
system "notify-send '#{title}' '#{message}' -i '#{image}' -t 2000" | |
end | |
def run_withnotify(*files) | |
image_root = File.expand_path("~/.autotest_images") | |
puts "Running: #{files.join(' ')}" | |
puts results = `bundle exec rspec -f p -c #{files.join(' ')}` | |
output, _, fail_count, _, pending_count = | |
*/(\d+)\sexamples?,\s(\d+)\sfailures?(,\s(\d+)\spendings?)?/.match(results) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# 英辞郎が提供する txt ファイルを Stardict が読める .tab 形式に変換する | |
# iconv の Shift_jis -> Utf-8 変換はうまくないみたいなので、nkf を使いましょう。 | |
# cat EIJI-129.TXT | nkf -w8Lu | ./mkstardicttab > eijirou.tab | |
# 最終的には stardict-tools の tabfile を使って | |
# /usr/lib/stardict-tools/tabfile eijirou.tab | |
# としてできたファイルを /usr/share/stardict/dic に置く |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mountpoint=/mnt/pogoplug | |
# find the current state of pogoplug | |
state=`pgrep pogoplugfs` | |
# if off, turn on, else off. | |
if [ "$state" = "" ]; then | |
pogoplugfs --user <email-address> --password <pogoplug_password> --mountpoint $mountpoint > /dev/null 2>&1 & |