Skip to content

Instantly share code, notes, and snippets.

View xuncheng's full-sized avatar
🎯
Focusing

Xuncheng Wang xuncheng

🎯
Focusing
View GitHub Profile
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
# Make mouse useful in copy mode
setw -g mode-mouse on
# Allow mouse to select which pane to use
set -g mouse-select-pane on
# Allow mouse dragging to resize panes
set -g mouse-resize-pane on
# Allow mouse to select windows
# .powrc
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ]; then
source "$rvm_path/scripts/rvm"
rvm use `cat .ruby-version`@`cat .ruby-gemset`
fi
@xuncheng
xuncheng / pry_pow
Created March 23, 2014 16:15
Using Pry with Pow
# In your Gemfile
gem 'pry-remote', :group => :development
# Install with bundler
$ bundle
# In your ruby code
binding.remote_pry
# In your terminal
class BasePresenter
attr_reader :object, :template
def initialize(object, template)
@object = object
@template = template
end
def self.presents(name)
define_method(name) { object }
# This custom matcher can be used to test state machine
#
# Examples
#
# it { should have_event(:status, :event_name, [:state1, :state2] => [:state3, :state4]) }
# it { should have_event(:status, :event_name, {
# :state1 => :state3,
# :state1 => :state4,
# :state3 => :state3,
# :state2 => :state4
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@xuncheng
xuncheng / reset_mysql_password.txt
Created June 3, 2014 02:38
reset mysql root password
# http://gistpages.com/2013/07/15/reset_mysql_root_password_on_mac_os
$ which mysqladmin
/usr/local/bin/mysqladmin
$ mysqladmin -u root -p password
Enter password:
New password:
Confirm new password:
class Parent
def say
puts "In Parent"
end
end
module A
def say
puts "In A"
super