Skip to content

Instantly share code, notes, and snippets.

@nysalor
nysalor / styles.css.scss
Created April 4, 2012 09:02
stylesheet with asset pipiline (scss) w/o asset-path
.bgimage {
background: #fffff url(image-path('css/background.png')) repeat-x;
}
@nysalor
nysalor / .zshrc
Created April 6, 2012 09:01
zsh configuration
# color
autoload -Uz colors
colors
# left prompt
case ${UID} in
0)
PROMPT="# "
PROMPT2="%_# "
SPROMPT="%{${fg[red]}%r%} %{$reset_color%}is correct? [n,y,a,e]: "
@nysalor
nysalor / .zshrc
Created April 22, 2012 07:21
display repository status on right prompt
# right prompt
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn hg bzr
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '[%b|%a]'
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r'
zstyle ':vcs_info:bzr:*' use-simple true
@nysalor
nysalor / rspec_crash_report.log
Created May 11, 2012 07:33
rspec crash report on MacOS 10.7.3
Process: ruby [60151]
Path: /Users/USER/*/ruby
Identifier: ruby
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: ruby [60090]
Date/Time: 2012-05-11 16:15:34.942 +0900
OS Version: Mac OS X 10.7.3 (11D50b)
Report Version: 9
# -*- coding: utf-8 -*-
require './age_calc'
require 'date'
describe AgeCalc do
before do
@age_calc = AgeCalc.new
end
it "birthdayで誕生日が設定できること" do
@nysalor
nysalor / age_calc.rb
Created July 27, 2012 11:21
TDD sample production code
class AgeCalc
attr_accessor :birthday
def age
@age ||= calculate_age
end
def calculate_age
if @birthday
(Time.now.strftime("%Y%m%d").to_i - @birthday.strftime("%Y%m%d").to_i) / 10000
@nysalor
nysalor / rails_app.yml
Created August 2, 2012 17:02
tmuxinator sample settings
# ~/.tmuxinator/rails_app.yml
# you can make as many tabs as you wish...
project_name: rails_app
project_root: ~/src/rails/rails_app
tabs:
- main:
layout: even-horizontal
panes:
- #shell
@nysalor
nysalor / .zshenv.sh
Created November 24, 2012 15:36
zsh settings for non-interactive shell with rvm
PATH=$HOME/.rvm/bin:$PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
(Date.new(2001,1,1)..Date.new(2019,12,31)).select { |x|
str = x.to_s.gsub('-0','')
str.split('').uniq.size == str.size
}.size
=> 210
ruby -r 'webrick' -e 'include WEBrick;HTTPServer.new(Port: 8888, DocumentRoot: "public_html/").start'