Skip to content

Instantly share code, notes, and snippets.

View greggroth's full-sized avatar

Greggory Rothmeier greggroth

  • GitHub
  • San Francisco, CA
View GitHub Profile
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on 0.0.0.0:36486, CTRL+C to stop
/home/runner/<redacted>/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/postgresql_adapter.rb:898:in `rescue in connect': FATAL: database "289675ae-9f24-4c3e-8e96-58e987e1f6c4_test" does not exist
Run `$ bin/rake db:create db:migrate` to create your database (ActiveRecord::NoDatabaseError)
@greggroth
greggroth / cssht
Created May 21, 2014 14:03
Control multiple ssh connections using Tmux. It creates a new tmux window with a pane ssh'd to each listed host and syncronizes the panes so input is sent to each pane. Inspired by csshx (https://code.google.com/p/csshx/).
#!/bin/bash
tmux_ssh () {
tmux send-keys 'ssh ' $1 'C-m'
}
split_and_ssh () {
tmux split-window -h
tmux_ssh $host
}
pry(main)> [1, 2, 3, 4]
=> [1, 2, 3, 4]
pry(main)> a = _
=> [1, 2, 3, 4]
pry(main)> a
=> [1, 2, 3, 4]
pry(main)> my_array = [1, 2, 3, 4, 5]
=> [1, 2, 3, 4, 5]
pry(main)> ls
self.methods: include private public to_s
locals: _ _dir_ _ex_ _file_ _in_ _out_ _pry_ my_array
pry(main)> cd my_array
pry(#<Array>):1> ls
Enumerable#methods: all? any? chunk collect_concat detect each_cons each_entry each_slice each_with_index each_with_object
entries find find_all flat_map grep group_by inject max max_by member? min min_by minmax minmax_by none? one?
partition reduce slice_before sort_by
pry(main)> .cd ~/code/rspec
pry(main)> .ls
Gemfile License.txt README.md Rakefile lib rspec.gemspec
pry(main)> .pwd
/Users/greggory/code/rspec
Pry.config.editor = 'vim'
pry(main)> edit dog.rb
# opens up vim where I add:
#
# class Dog
# def bark
# puts "Woof!"
# end
# end
pry(main)> hist --grep foo
2: def foo
3: puts "Welcome to the foo!!"
5: show-method foo
pry(main)> def foo
pry(main)* puts "Welcome to the foo!!"
pry(main)* end
=> nil
pry(main)> show-method foo
From: (pry) @ line 3:
Number of lines: 3
Owner: Object
Visibility: private
pry(main)> show-doc Array#sort!
From: array.c (C Method):
Number of lines: 9
Owner: Array
Visibility: public
Signature: sort!()
Sorts self. Comparisons for
the sort will be done using the <=> operator or using