Skip to content

Instantly share code, notes, and snippets.

@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 / .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 / 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 / styles.css.scss
Created April 4, 2012 09:00
stylesheet with asset pipiline (scss)
.bgimage {
background: #fffff url(asset-path('css/background.png', image)) repeat-x;
}
@nysalor
nysalor / styles.css.erb
Created April 4, 2012 08:58
stylesheet with asset pipiline (erb)
.bgimage {
background: #fffff url("<%= asset_path 'css/background.png' %>") repeat-x;
}
--- a/src/nsterm.m 2012-03-20 12:48:57.000000000 +0900
+++ b/src/nsterm.m 2012-03-20 13:22:16.000000000 +0900
@@ -4708,9 +4708,7 @@
if (NS_KEYLOG)
NSLog (@"firstRectForCharRange request");
- if (NILP (Feval (Fcons (intern ("ns-in-echo-area"), Qnil))))
- win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
- else if (WINDOWP (echo_area_window))
+ if (WINDOWP (echo_area_window))
@nysalor
nysalor / staging.rb
Created March 8, 2012 09:36
capistrano multistage deploy_to(fixed)
set(:deploy_to) { "/var/www/#{application}-#{rails_env}" }
set(:releases_path) { File.join(deploy_to, version_dir) }
set(:shared_path) { File.join(deploy_to, shared_dir) }
set(:current_path) { File.join(deploy_to, current_dir) }
set(:release_path) { File.join(releases_path, release_name) }
# unicornを使っているなら以下も
set(:unicorn_config) { "#{current_path}/config/unicorn.rb" }
set(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" }
@nysalor
nysalor / staging.rb
Created March 8, 2012 09:35
capistrano multistage deploy_to
set :rails_env, 'staging'
set :branch, 'trunk'
set :deploy_to, "/var/www/#{application}-#{rails_env}"
role :web, "staging-server"
role :app, "staging-server"
role :db, "staging-server", :primary => true
@nysalor
nysalor / deploy_assets.rb
Created March 5, 2012 05:38
deploy settings for remote precompile
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
@nysalor
nysalor / create_uploader.js.coffee
Created March 5, 2012 04:41
fileuploader initialize script
# initializer for fileuploader.js(http://github.com/valums/file-uploader)
@create_uploader = (upload_action, complete_action, token) =>
uploader = new qq.FileUploader {
element: document.getElementById('upload'),
action: upload_action,
debug: false,
params: {
authenticity_token: token
},
onComplete: () =>