Keybinding | - | Description |
---|---|---|
Ctrl-1 |
- | Move to 1st tab (work every number) |
Ctrl-p |
- | Go to anything |
Ctrl-g |
- | Go to line |
Ctrl-r |
- | Go to symbol (e.g. section and labels) |
Ctrl-m |
- | Move to bracket |
https://twitter.com/garybernhardt/status/349920138889404416 | |
[1] pry(main)> class Object; alias_method :&, :method; end | |
=> Object | |
With standard symbol to proc, &:foo evaluates to: | |
{ |x| x.foo } | |
With the "pretzel bun", &foo&:bar evaluates to: |
# assuming your subject is the UsersController with a method user_params | |
describe UsersController do | |
describe "params" do | |
# per default the matcher extracts the subject and params method | |
it { should permit_params(:email, :name, :role) } | |
# to overwrite the params method use explicit .params_method() | |
it { should permit_params(:first_name, :last_name).params_method(:other_user_params) } | |
#!/usr/bin/env ruby | |
# A pre-commit hook script to ensure that no local gem dependencies (gem 'asdf', path: '~/local') | |
# exist in your Gemfile before commiting.` | |
# Allows gems to be loaded from source within the current project directory, but not from outside. | |
puts 'Checking for local dependencies in your Gemfile.' | |
ROOT_PATH = File.expand_path('../../..', __FILE__) | |
NESTED_GEMSPECS = Dir["#{ROOT_PATH}/**/*.gemspec"] | |
GEMFILE = ENV['BUNDLE_GEMFILE'] || File.join(ROOT_PATH, 'Gemfile') |
class Address | |
def initialize address, display_name, domain | |
@address = address | |
@display_name = display_name | |
@domain = domain | |
end | |
attr_reader :address, :display_name, :domain | |
def self.from_header h # returns an Array of Addresses |
Let's say you wanted to install this plugin: https://github.com/finnlabs/openproject-meeting. Here is how you would do it with the openproject version packaged at https://pkgr.io/apps/tessi/openproject:
cat >> /opt/openproject/Gemfile.plugins <<EOF
gem "openproject-plugins", :git => "https://github.com/opf/openproject-plugins.git", :branch => "stable"
gem "openproject-meeting", :git => "https://github.com/finnlabs/openproject-meeting.git", :branch => "stable"
EOF
Uberspace (an awesome german web hoster) has superb postgresql support, except that it currently only offers postgresql versions 9.2.x
and 9.3.x
. I run postgresql 9.6.2
on my uberspace and documented steps for a migration to postgresql 9.6
here.
My goal was to be as close to the original uberspace-postgresql-setup as possible, but I had to copy and modify some uberspace scripts so they correctly use the new postgresql version.
Warning: Here be dragons. This is what I did -- that doesn't mean you should do the same or what I did was clever. Always backup your data and maybe test on a throw-away uberspace first. If you find things to improve, let me know and I'll try to keep this updated.
#!/usr/bin/env ruby | |
# A simply utility to show character counts for each line of input and | |
# highlight lines longer than 80 characters. | |
# | |
# Written as an example for http://jstorimer.com/2011/12/12/writing-ruby-scripts-that-respect-pipelines.html | |
# | |
# Examples: | |
# | |
# $ hilong Gemfile |
// swap the keybindings for paste and paste_and_indent | |
{ "keys": ["super+v"], "command": "paste_and_indent" }, | |
{ "keys": ["super+shift+v"], "command": "paste" } |
Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.
This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.
You are encouraged to fork this and modify it to your heart's content to match your own needs.