Skip to content

Instantly share code, notes, and snippets.

View sundevilyang's full-sized avatar
😃

Yang Wen sundevilyang

😃
  • ByteDance
  • Beijing
View GitHub Profile
@sundevilyang
sundevilyang / Gemfile
Created October 2, 2012 06:09 — forked from zernel/Gemfile
Devise authentication with multiple provider
gem 'devise'
gem 'omniauth'
gem 'omniauth-github'
gem "omniauth-twitter"
gem "omniauth-facebook"
gem "omniauth-google-oauth2"
@sundevilyang
sundevilyang / Gemfile
Created October 19, 2012 01:54 — forked from HungYuHei/Gemfile
followable with redis Sorted-Set
# Gemfile
gem 'redis', '~> 3.0.1'
@sundevilyang
sundevilyang / smser.rb
Created October 19, 2012 01:56 — forked from HungYuHei/smser.rb
短信宝
# -*- encoding: utf-8 -*-
require 'digest/md5'
require 'nestful'
class Smsbao
attr_accessor :login, :passwd
def initialize(login, passwd)
@login = login
@passwd = Digest::MD5.hexdigest(passwd)
@sundevilyang
sundevilyang / bootstrap.rb
Created October 27, 2012 00:42 — forked from jordanbyron/bootstrap.rb
Standard Rails Template
# Usage:
# rails new myapp --template=path/to/this/file.rb
appname = File.expand_path(Dir.new('.')).split('/').last
#--------------- Gem setup
# Note this is mostly copied from puzzlenode
#
file 'Gemfile', <<_____
source 'http://rubygems.org'
@sundevilyang
sundevilyang / database.yml.example mysql2
Created October 27, 2012 07:38 — forked from erichurst/database.yml.example mysql2
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@sundevilyang
sundevilyang / tmux latest
Created November 5, 2012 11:47 — forked from jespada/tmux latest
tmux
set -g prefix C-a
unbind %
bind | split-window -h
bind - split-window -v
bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R
# status bar
require 'rubygems'
require 'chinese_pinyin'
name = []
cp = false
def p(z)
Pinyin.t(z, '')
end
# PostgreSQL. Versions 7.4 and 8.x are supported.
#
# Install the pg driver:
# gem install pg
# On Mac OS X with macports:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.