Skip to content

Instantly share code, notes, and snippets.

View ysawa's full-sized avatar

Ysawa ysawa

View GitHub Profile
@ysawa
ysawa / .vimrc
Created July 2, 2012 00:32
my .vimrc 2012/07/02
syntax on
set number
set nocompatible
set nosmartcase
set expandtab
set ts=2 st=2 sts=2
set shiftwidth=2
set cursorline
@ysawa
ysawa / Gemfile
Created September 27, 2012 09:50
Partial codes of Gemfile to notify on Mac OS X, Linux, and Windows
# Notifiers
case RUBY_PLATFORM
when /linux/i
gem 'libnotify'
when /darwin/i
gem 'growl'
when /mswin(?!ce)|mingw|cygwin|bccwin/i
gem 'rb-notifu'
end
@ysawa
ysawa / spec_helper.rb
Created October 16, 2012 08:51
use Mongoid 3 and delete all collections before :each spec
# Mongoid 3 uses Moped as MongoDB driver, not mongo-ruby-driver.
# Thus we should replace some codes.
# Change your spec/spec_helper.rb like this code below:
RSpec.configure do |config|
config.before(:each) do
Mongoid.session(:default).collections.each do |collection|
# Each Moped::Collection instance is picked up,
# and drop the collection.
collection.drop
@ysawa
ysawa / checkdomainname.sh
Created October 28, 2012 17:14
Check if a new domain name is available.
#!/bin/bash
# Name: Check for domain name availability
# linuxconfig.org
# Please copy, share, redistribute and improve
if [ "$#" == "0" ]; then
echo "You need tu supply at least one argument!"
exit 1
fi
@ysawa
ysawa / insertAtCaret.js.coffee
Created October 29, 2012 23:21
jQuery insertAtCaret CoffeeScript
jQuery.fn.extend insertAtCaret: (myValue) ->
@each (i) ->
if document.selection
# For browsers like Internet Explorer
@focus()
sel = document.selection.createRange()
sel.text = myValue
@focus()
else if @selectionStart or @selectionStart is "0"
# For browsers like Firefox and Webkit based
@ysawa
ysawa / .vimrc
Created November 13, 2012 01:34
UTF-8-MACの濁点、半濁点を含む文字を強調して表示する .vimrc
" UTF-8-MACの濁点、半濁点を含む文字を強調して表示する
highlight Opaques term=underline ctermbg=DarkGreen guibg=DarkGreen
match Opaques /\(\%u3099\|%u309a\)/
@ysawa
ysawa / .gitignore
Last active December 11, 2015 20:18
.gitignore often used.
/Gemfile.lock
# Ignore bundler config
/.bundle
# Ignore configuration files
/config/*.yml
/config/unicorn.rb
/config/deploy.rb
@ysawa
ysawa / .vimrc
Created January 29, 2013 03:30
Macでバックスペースが効かないよう。
" Backspace on Mac
set backspace=indent,eol,start
@ysawa
ysawa / 都道府県.md
Last active December 17, 2015 08:39
都道府県情報のフォーマットをいくつか用意しました。対応形式はCSVとJSONです。 (MIT LICENSE)

都道府県

CSV

簡易版

北海道,青森県,岩手県,宮城県,秋田県,山形県,福島県,茨城県,栃木県,群馬県,埼玉県,千葉県,東京都,神奈川県,新潟県,富山県,石川県,福井県,山梨県,長野県,岐阜県,静岡県,愛知県,三重県,滋賀県,京都府,大阪府,兵庫県,奈良県,和歌山県,鳥取県,島根県,岡山県,広島県,山口県,徳島県,香川県,愛媛県,高知県,福岡県,佐賀県,長崎県,熊本県,大分県,宮崎県,鹿児島県,沖縄県
@ysawa
ysawa / shaky_ios_icon.sass
Last active December 17, 2015 08:49
iPhoneやiPadのブルブル震えるようなアイコンをCSS3で再現する。(MIT LICENSE)
@-webkit-keyframes shaky_animation
0%
+transform(rotate(0))
25%
+transform(rotate(3deg))
50%
+transform(rotate(0))
75%
+transform(rotate(-3deg))