Skip to content

Instantly share code, notes, and snippets.

reyesyang / .gemrc
Created Jun 22, 2017 — forked from jch/.gemrc
gemrc example
View .gemrc
gem: --no-ri --no-rdoc
benchmark: false
verbose: true
update_sources: true
backtrace: true
reyesyang / .gtkrc-eclipse
Created Jun 6, 2017 — forked from andrioli/.gtkrc-eclipse
Config to make Eclipse Juno icons and tabs look small and nice in Linux
View .gtkrc-eclipse
# Create a new file in your home directory called .gtkrc-eclipse
# call eclipse with this command:
# Gtk2 forced:
# export SWT_GTK3=0
# env GTK2_RC_FILES=/usr/share/themes/<YourTheme>/gtk-2.0/gtkrc:/home/<YourUser>/.gtkrc-eclipse '/path_to_eclipse/eclipse'
# In your Eclipse directory find the file 'e4_default_gtk.css'
# In this file there's a CSS class:
reyesyang /
Created Mar 18, 2017
Bootstrap a fresh ubuntu machine with dev tools
echo '***** Build tools *****'
sudo apt install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
echo '***** Dev tools *****'
sudo apt install -y git gitg tmux vim-gnome exuberant-ctags memcached redis-server\
mysql-server mongodb postgresql haskell-platform libmysqlclient-dev ipython python-dev\
libsqlite3-dev ubuntu-make
reyesyang / net_http.rb
Last active Jun 2, 2016
Net::HTTP examples
View net_http.rb
require 'net/http'
# Proxy
proxy_server = ''
proxy_port = 81
## Example 1'', nil, proxy_server, proxy_port).start { |http| http.get '/' }
## Example 2
reyesyang / nancy.rb
Created Dec 1, 2015
Nancy is a Sinatra like micro framework for study base on thoughtbot blog:
View nancy.rb
require 'rubygems'
require 'bundler/setup'
require 'rack'
require 'pry'
module Nancy
METHODS = %w(get post put patch delete head)
class Base
View Smokestack.rb
module Smokestack
@registry = {}
def self.registry
def self.define(&block)
reyesyang / kaminari-i18n-zh-CN.yml
Last active Aug 29, 2015
Kaminari I18n translation in zh-CN language
View kaminari-i18n-zh-CN.yml
# Usage:
# 1. Put this file in config/locales/kaminari/zh-CN.yml
# 2. Set load_path in config/application.rb as below:
# config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
first: "&laquo; 首页"
last: "末页 &raquo;"
reyesyang /
Created Jul 16, 2015
Generate SSL Key, CSR and Self Signed Certificate
# Generate Private Key:
openssl genrsa -out server.key 1024
# Generate a Certificate Signing Request (CSR)
openssl req -new -key server.key -out server.csr
# Generate a Self-Signed SSL Certificate
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
reyesyang / grape-i18n-zh-CN.yml
Last active Apr 22, 2017
Grape I18n translation in zh-CN language
View grape-i18n-zh-CN.yml
# Usage:
# 1. Put this file in config/locales/grape/zh-CN.yml
# 2. Set load_path in config/application.rb as below:
# config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
format: ! '%{attributes} %{message}'
reyesyang / rails_template.rb
Last active Aug 29, 2015
Rails project template
View rails_template.rb
# rails new . -d mysql --skip-test-unit
# rails new . --skip-active-record --skip-test-unit
# Edit Gemfile
if yes?('Replace gem source "" with Taobao mirror ""?(y/n)')
gsub_file 'Gemfile', '', ''
use_mongodb = yes?('Use MongoDB?(y/n)')
gem 'jquery-turbolinks'