- install rbenv and ruby-build plugin via git clone.
rbenv install --list
rbenv install target-ruby-version
(such asrbenv install 2.1.0
)echo $PATH
# ~.rbenv/shims should be the head of path. Ensure gem is ~/.rbenv/shims/gem, not the old system gem.rbenv local target-ruby-version
gem install bundle -V
keep eyes on thegem
cmd path, which should be~/.rbenv/shims/gem
.rbenv rehash
bundle install --path=vendor/bundle
bundle path should be~/.rbenv/shims/bundle
bundle exec some-shell-cmd
This file contains 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
(function(){ | |
//fix a special bug in mobile safari, see https://discussions.apple.com/message/23745665#23745665 | |
var multiSelect = $('select[multiple]'); | |
multiSelect.on('blur',function(){ | |
var me = $(this); | |
me.data('value',me.val()); | |
setTimeout(function(){ | |
me.val(me.data('value')); |
This file contains 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
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 |
This file contains 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
<form action="http://up.qiniu.com/" enctype="multipart/form-data" class="dropzone dz-clickable" id="upload-form"> | |
<div class="dz-default dz-message"> | |
<span>Drop files here to upload</span> | |
</div> | |
<input name="token" type="hidden" value="<%= @token %>"> | |
<input name="x:uid" type="hidden" value="<%= current_user.id %>"> | |
<div class="fallback"> | |
<input name="file" type="file" multiple /> |
This file contains 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
#cat ~/.bundler/config | |
#gem install bundler --pre | |
number_of_cores=`sysctl -n hw.ncpu` | |
bundle config --global jobs `expr $number_of_cores - 1` |
This file contains 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
<% flash.each do |type, message| %> | |
<div class="alert <%= bootstrap_class_for(type) %> fade in"> | |
<button class="close" data-dismiss="alert">×</button> | |
<%= message %> | |
</div> | |
<% end %> |
This file contains 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
# 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 |
This file contains 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> | |
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> | |
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> |
This file contains 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
# compl1.rb - Redis autocomplete example | |
# download female-names.txt from http://antirez.com/misc/female-names.txt | |
require 'rubygems' | |
require 'redis' | |
r = Redis.new | |
# Create the completion sorted set | |
if !r.exists(:compl) |
This file contains 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
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 | |
db.createReadStream({ | |
start: prefix, // jump to first key with the prefix |
OlderNewer