MetadataChopper.extract('metdata.rb') # => [ "rvm", "0.9.1" ]
This file contains hidden or 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
| desc 'generate a class in lib/ and a spec in spec/lib/ for name=underscored_class_name' | |
| task :genclass do | |
| require 'erb' | |
| filename = ENV['name'] | |
| raise 'must specify name=underscored_class_name' unless filename | |
| classname = filename.camelize | |
| class_file_template = ERB.new <<-EOF | |
| class <%= classname %> |
- Your class can be no longer than 100 lines of code.
- Your methods can be no longer than five lines of code.
- You can pass no more than four parameters and you can’t just make it one big hash.
- When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.
You can break these rules if you can talk your pair into agreeing with you.
This file contains hidden or 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 bash | |
| # | |
| # Wraps curl with a custom-drawn progress bar. Use it just like curl: | |
| # | |
| # $ curl-progress -O http://example.com/file.tar.gz | |
| # $ curl-progress http://example.com/file.tar.gz > file.tar.gz | |
| # | |
| # All arguments to the program are passed directly to curl. Define your | |
| # custom progress bar in the `print_progress` function. | |
| # |
This file contains hidden or 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
| " Based on Gary Bernhardt's .vimrc file: | |
| " https://github.com/garybernhardt/dotfiles/blob/master/.vimrc | |
| " vim: set ts=2 sts=2 sw=2 expandtab: | |
| " | |
| " global settings {{{ | |
| " | |
| " enter vim mode | |
| set nocompatible | |
| " allow unsaved background buffers and remember marks/undo for them |
This file contains hidden or 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
| [alias] | |
| fixup = !sh -c 'REV=$(git rev-parse $1) && git commit --fixup $@ && git rebase -i --autosquash $REV^' - | |
| squash = !sh -c 'REV=$(git rev-parse $1) && git commit --squash $@ && git rebase -i --autosquash $REV^' - |
This file contains hidden or 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
| # If you're having cert issues on ruby 2.0.0-p0, the issue is most likely that ruby can't | |
| # find the required intermediate certificates. If you built it via rbenv/ruby-build, then | |
| # the certs are already on your system, just not where ruby expects them to be. | |
| # When ruby-build installs openssl, it installs the CA certs here: | |
| ~/.rbenv/versions/2.0.0-p0/openssl/ssl/cacert.pem | |
| # Ruby is expecting them here: | |
| $(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE') | |
| # Which for me, is this path: |
This file contains hidden or 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 | |
| pid = Kernel.fork do | |
| `#{ARGV.join(" ")}` | |
| exit | |
| end | |
| trap(:CHLD) do | |
| print "\n" | |
| exit |
This file contains hidden or 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
| // This is a dead simple wrapper that can have setuid set on it so that | |
| // the sudo helper is run as root. It is expected to run in the same CWD | |
| // as the actual Ruby sudo helper. Any arguments to this script are forwarded | |
| // to the Ruby sudo helper script. | |
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "path/filepath" |
This file contains hidden or 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
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "io" | |
| "log" | |
| "mime/multipart" | |
| "net/http" | |
| "os" |