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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swap the keybindings for paste and paste_and_indent | |
{ "keys": ["super+v"], "command": "paste_and_indent" }, | |
{ "keys": ["super+shift+v"], "command": "paste" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It | |
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as | |
you did, the {internet|net|web} will be {much more|a lot more} | |
useful than ever before.| | |
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!| | |
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} | |
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any? | |
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe. | |
Thanks.| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) } | |
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH table_scans as ( | |
SELECT relid, | |
tables.idx_scan + tables.seq_scan as all_scans, | |
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
pg_relation_size(relid) as table_size | |
FROM pg_stat_user_tables as tables | |
), | |
all_writes as ( | |
SELECT sum(writes) as total_writes | |
FROM table_scans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer