Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'benchmark'
def method_1
`curl -s #{ARGV.first} | echo`
end
10.times do |i|
sleep 1
@rainly
rainly / gist:882882
Created March 23, 2011 10:00 — forked from alvin2ye/gist:400946
ruby backup mysql
require 'rubygems'
gem 'rubyzip'
require 'zip/zipfilesystem'
require 'zip/zip'
require 'dbi'
ODBC_NAME='dbi:ODBC:visteam'
# ODBC_NAME='dbi:ODBC:mypdm'
USER_NAME='ReadOnly'
gem install rails aws-s3 deploy_kit hirb mime-types \
mislav-will_paginate mocha nifty-generators \
nokogiri passenger pog rack rake RedCloth \
rspec rspec-rails ruby-openid ruby_parser \
rubyzip spreadsheet uuid uuidtools --no-ri --no-rdoc
#!/bin/bash
# Install Guide:
# 1. Use http://www.virtualbox.org if you use Windows or OS X
# 2. Download http://www.ubuntu.com 9.04 Desktop Edition and install into VM.
# 3. In your ubuntu console:
# $ wget http://gist.github.com/raw/180820/333b288a1b5df8df09842bfcfa248fa252f0cf3b/rails_install_script_on_ubuntu
# $ chmod 555 rails_install_script_on_ubuntu
# $ ./rails_install_script_on_ubuntu
Gems:
gem 'cucumber'
gem 'cucumber-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'spork'
gem 'watchr'
@rainly
rainly / remove all the gems
Created March 23, 2011 14:24 — forked from flyerhzm/remove all the gems
remove all the gems
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
local_filename = "create_file_name.rb"
doc =<<'FILE'
# This is a text for the file #{local_filename}.
FILE
File.open(local_filename, 'w+') {|f| f.write(doc) }
@rainly
rainly / git_tips.md
Created May 1, 2011 00:58 — forked from fguillen/git_tips.md
Git Tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo

@rainly
rainly / will_paginate_left_right_arrrow
Created August 24, 2011 05:32 — forked from huacnlee/will_paginate.js
使 WillPaginate 支持用左右键翻页
// From Dribbble.com
// Keyboard shortcuts for browsing pages of lists
// 使 WillPaginate 支持用左右键翻页
(function($) {
$(document).keydown(handleKey);
function handleKey(e){
var left_arrow = 37;
var right_arrow = 39;
if (e.target.localName == 'body' || e.target.localName == 'html') {
@rainly
rainly / 12306.user.js
Created January 5, 2012 09:49 — forked from quietlynn/12306.user.js
下载,解压,拖到 Chrome 中或是配合 GreaseMonkey 使用,12306订票专用。
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js