View multiple-select-for-ios.js
//fix a special bug in mobile safari, see
var multiSelect = $('select[multiple]');
var me = $(this);'value',me.val());
View rename.rb
count = 0;
Dir["./src/main/webapp/assets/**/*.css"].each {|f|
# File.rename(f, f.downcase)
count = count + 1
system("git mv #{f} #{f.sub(/.css$/,'.less')}")
puts count
# find src/main/webapp/assets -name *.css|wc -l
View dropzone-upload-file.erb
<form action="" enctype="multipart/form-data" class="dropzone dz-clickable" id="upload-form">
<div class="dz-default dz-message">
<span>Drop files here to upload</span>
<input name="token" type="hidden" value="<%= @token %>">
<input name="x:uid" type="hidden" value="<%= %>">
<div class="fallback">
<input name="file" type="file" multiple />
#cat ~/.bundler/config
#gem install bundler --pre
number_of_cores=`sysctl -n hw.ncpu`
bundle config --global jobs `expr $number_of_cores - 1`
  1. install rbenv and ruby-build plugin via git clone.
  2. rbenv install --list
  3. rbenv install target-ruby-version(such as rbenv install 2.1.0)
  4. echo $PATH # ~.rbenv/shims should be the head of path. Ensure gem is ~/.rbenv/shims/gem, not the old system gem.
  5. rbenv local target-ruby-version
  6. gem install bundle -V keep eyes on the gem cmd path, which should be ~/.rbenv/shims/gem.
  7. rbenv rehash
  8. bundle install --path=vendor/bundle bundle path should be ~/.rbenv/shims/bundle
  9. bundle exec some-shell-cmd
View _flash_messages.html.erb
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
<% end %>
View .slate
# Configs
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
config keyboardLayout qwerty
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
View carousel.html
View redis-keys-prefix-search.rb
# compl1.rb - Redis autocomplete example
# download female-names.txt from
require 'rubygems'
require 'redis'
r =
# Create the completion sorted set
if !r.exists(:compl)
View leveldb-keys-prefix-search.js
var levelup = require('levelup')
// open a data store
var db = levelup('/tmp/foo.leveldb')
var list = [];
var start = new Date().getTime();
var prefix = "ha";
//cat /usr/share/dict/words | grep "^ha" | wc
start: prefix, // jump to first key with the prefix