Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some minor reorganization.

  • Loading branch information...
commit 4f5154c306fecabbfc6746b79d5758402c6e86a8 1 parent 13b851b
@alexw668 authored
View
5 bash/aliases
@@ -16,10 +16,13 @@ fi
# some more aliases
a cls='clear'
+a cls2='reset'
a ll='ls -alF'
a la='ls -A'
a l='ls -CF'
a pop='cd ..'
+a pop2='cd ../..'
+a pop3='cd ../../..'
a pd='pushd'
a home='cd ~/'
a k9='kill -9'
@@ -61,6 +64,8 @@ a amqp_q='sudo rabbitmqctl list_queues'
a amqp_e='sudo rabbitmqctl list_exchanges'
a amqp_s='sudo rabbitmqctl status'
+a be='bundle exec'
+
# gem install
a get_gem='sudo gem install'
# gem install without rdoc and ri
View
14 bash/gready
@@ -0,0 +1,14 @@
+#!/bin/sh -x
+# Put what's in the current feature branch and merge into the master branch and commit by squashing
+# commit comments in feature branch
+# If extra params passed in, also push it back to origin master
+CURRENT=`git branch | grep '\*' | awk '{print $2}'`
+git checkout master
+git merge --squash ${CURRENT}
+git commit -a
+if [ -z $1 ]; then
+ echo "Feature branch is now merged into master branch with committment. You may want to consider pushing it back to remote master branch."
+else
+ git push
+ git checkout ${CURRENT}
+fi
View
7 bash/grefresh
@@ -0,0 +1,7 @@
+#!/bin/sh -x
+# Ensure that the current feature branch is up-to-date with the origin master one
+CURRENT=`git branch | grep '\*' | awk '{print $2}'`
+git checkout master
+git pull origin master
+git checkout ${CURRENT}
+git rebase master
View
6 bashrc
@@ -19,8 +19,6 @@ fi
prepend_path $HOME/workpad/perl
prepend_path $HOME/workpad/bash
-prepend_path $HOME/FlightLink/RpmOnline/script
-prepend_path $HOME/local/bin/myscripts
# parse_git_branch function is defined in bash/functions
PS1="\w\$(parse_git_branch) $ "
@@ -55,3 +53,7 @@ function gemdoc {
open $GEMDIR/`ls $GEMDIR | grep $1 | sort | tail -1`/rdoc/index.html
}
alias rurl="rake routes | sed -e '1d;s,^[^/]*,,;s, .*,,' | sort | uniq"
+
+# PWS
+export PWS="$HOME/Documents/Dropbox/MyDocs/.safe/pws"
+alias pw='pws'
View
13 dot.aprc
@@ -0,0 +1,13 @@
+#!/usr/bin/ruby
+
+AwesomePrint.defaults = {
+ :indent => -3,
+ :limit => 10,
+ :color => {
+ :hash => :pale,
+ :class => :white,
+ :string => :greenish,
+ :date => :yellow,
+ :time => :yellowish
+ }
+}
View
3  dot.gemrc
@@ -0,0 +1,3 @@
+rdoc: --inline-source --line-numbers --format=html --template=hanna
+install: --no-ri --no-rdoc
+update: --no-ri --no-rdoc
View
21 git/gitconfig → dot.gitconfig
@@ -1,5 +1,6 @@
[alias]
- unstage = reset HEAD --
+ # unstage newly added (staged) file(s)
+ unadd = reset HEAD --
undo = checkout --
# To undo all changes
undoall = reset --hard HEAD
@@ -7,10 +8,23 @@
undoall2 = reset --hard ORIG_HEAD
last = log -1 HEAD
s = status
+ # push/pull to/from master branch
upload = push origin master
dnload = pull origin master
dnload2 = pull --rebase origin master
- uncommit = reset --hard HEAD^
+ # undo commits
+ uncommit = reset --soft HEAD^
+ uncommit2 = reset --hard HEAD^
+ switch = checkout
+
+ b = branch
+ co = checkout
+ # checkout a branch; create it if it does not exist
+ co2 = checkout -b
+
+ # list of files changed
+ dlist = diff --stat
+ where = !sh -c 'git ls-files | grep $1' -
[user]
name = Alex Wang
@@ -18,7 +32,8 @@
[color]
ui = true
[core]
- editor = emacs
+ editor = vi
+ #editor = ~/local/bin/sublime/sublime_text
[merge]
tool = ext_merge_tool
View
68 irbrc → dot.irbrc
@@ -2,22 +2,24 @@
require "rubygems"
-def start_ap
- require "ap"
- IRB::Irb.class_eval do
- def output_value
- ap @context.last_value
- end
- end
-end
-
-def stop_ap
- IRB::Irb.class_eval do
- def output_value
- puts "#{@context.last_value.inspect}"
- end
- end
-end
+puts "Loading IRB..."
+
+# def start_ap
+# require "ap"
+# IRB::Irb.class_eval do
+# def output_value
+# ap @context.last_value
+# end
+# end
+# end
+
+# def stop_ap
+# IRB::Irb.class_eval do
+# def output_value
+# puts "#{@context.last_value.inspect}"
+# end
+# end
+# end
class Object
# list methods which aren't in superclass
@@ -58,7 +60,7 @@ end
# Where quasi global methods belong (Thanks to aperios for teaching me!)
module Kernel
-
+
# Awesome benchmarking function
# Example: bench(100) do ... end
# Source: http://ozmm.org/posts/time_in_irb.html
@@ -84,7 +86,7 @@ module Kernel
def copy(str)
IO.popen('xclip -i', 'w') { |f| f << str.to_s }
end
-
+
def paste
`xclip -o`
end
@@ -108,7 +110,7 @@ class Array
end
end
-start_ap
+# start_ap
# Not to use any encoding
$KCODE=""
@@ -118,7 +120,7 @@ require "irb/completion"
# Automatic Indentation
IRB.conf[:AUTO_INDENT]=true
-
+
# Save History between irb sessions
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 100
@@ -130,9 +132,9 @@ IRB.conf[:PROMPT_MODE] = :SIMPLE
# Syntax highlighting (to work with Rails 3, wirble needs to be added in Gemfile)
require 'rubygems'
#%x{gem install 'wirble' --no-ri --no-rdoc} unless Gem.available?('wirble')
-#Gem.refresh
+#Gem.refresh
require 'wirble'
-
+
Wirble.init
Wirble.colorize
@@ -152,26 +154,26 @@ def clear
return "No rails environment - happy hacking!";
end
end
-
+
# Shortcuts
alias cls clear
-def seconds_to_s time_period
+def seconds_to_s time_period
out_str = ''
-
+
interval_array = [ [:weeks, 604800], [:days, 86400], [:hours, 3600], [:mins, 60] ]
interval_array.each do |sub|
if time_period>= sub[1] then
time_val, time_period = time_period.divmod( sub[1] )
-
+
time_val == 1 ? name = sub[0].to_s.singularize : name = sub[0].to_s
-
+
( sub[0] != :mins ? out_str += ", " : out_str += " and " ) if out_str != ''
out_str += time_val.to_s + " #{name}"
end
end
-
- return out_str
+
+ return out_str
end
#########################
@@ -205,7 +207,7 @@ class Object
end
max_name = data.collect {|item| item[0].size}.max
max_args = data.collect {|item| item[1].size}.max
- data.each do |item|
+ data.each do |item|
print "#{ANSI_LGRAY}#{item[0].rjust(max_name)}#{ANSI_RESET}"
print "#{ANSI_BLUE}#{item[1].ljust(max_args)}#{ANSI_RESET}"
print "#{ANSI_RED}#{item[2]}#{ANSI_RESET}\n"
@@ -220,13 +222,13 @@ if ENV['RAILS_ENV']
rails_root = File.basename(Dir.pwd)
prompt = "#{rails_root}[#{rails_env.sub('production', 'prod').sub('development', 'dev')}]"
IRB.conf[:PROMPT] ||= {}
-
+
IRB.conf[:PROMPT][:RAILS] = {
:PROMPT_I => "#{prompt}>> ",
:PROMPT_S => "#{prompt}* ",
:PROMPT_C => "#{prompt}? ",
- :RETURN => "=> %s\n"
+ :RETURN => "=> %s\n"
}
-
+
IRB.conf[:PROMPT_MODE] = :RAILS
end
View
5 dot.pryrc
@@ -0,0 +1,5 @@
+#!/usr/bin/ruby
+require "rubygems"
+require "awesome_print"
+
+Pry.print = proc { |output, value| output.puts value.ai }
View
2  dot.rspec
@@ -0,0 +1,2 @@
+--format Fuubar
+--color
View
23 pryrc
@@ -1,23 +0,0 @@
-#!/usr/bin/ruby
-
-require "rubygems"
-require "ap"
-
-# def start_ap
-# require "ap"
-# IRB::Irb.class_eval do
-# def output_value
-# ap @context.last_value
-# end
-# end
-# end
-
-# def stop_ap
-# IRB::Irb.class_eval do
-# def output_value
-# puts "#{@context.last_value.inspect}"
-# end
-# end
-# end
-
-# start_ap
Please sign in to comment.
Something went wrong with that request. Please try again.