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
a = b | |
a.b = B | |
c.e = true | |
1234=1234 |
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
~ $ cat tmp/erb_example.rb | |
#!/usr/bin/env ruby | |
require 'erb' | |
template = "number: <%= @number %>\nstring: <%= @string %>" | |
@number = 3.4 | |
@string = 'blue' | |
puts ERB.new(template).result |
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
# given a list of hashes: | |
foo = [ | |
{ a: whatever, b: whatever, c: whatever }, | |
{ a: whatever, b: whatever, c: whatever }, | |
# ... | |
] | |
bar = { b: whatever, y: whatever, z: whatever } |
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
require 'rspec' | |
def remove_whitespace(string) | |
lines = string.lines | |
# remove leading and trailing blank lines | |
lines.shift while lines.first.strip.empty? | |
lines.pop while lines.last.strip.empty? | |
# remove trailing whitespace from lines | |
lines.map(&:rstrip).join("\n") | |
end |
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
^\w+(\.\w+)*@(\w+\.)*\w+\.\w+$ |
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://gist.github.com/atheiman/2b359b3da6a80fc0a6c8d54c78abfc5b | |
# | |
# Write a function (with helper functions if needed) called to Excel that takes | |
# an excel column value (A,B,C,D…AA,AB,AC,… AAA..) and returns a corresponding | |
# integer value (A=1,B=2,… AA=27..). | |
module ExcelAlpha | |
ALPHA_HASH = Hash[('A'..'Z').to_a.zip (1..26).to_a].freeze | |
DECIMAL_HASH = ALPHA_HASH.invert.freeze | |
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
[root@dokken ~]# /usr/local/ruby/jruby-9.1.13.0/bin/ruby -rnet/http -e "Net::HTTP.get(URI('https://www.google.com/'))" | |
OpenSSL::SSL::SSLError: certificate verify failed | |
connect_nonblock at org/jruby/ext/openssl/SSLSocket.java:228 | |
connect at /usr/local/ruby/jruby-9.1.13.0/lib/ruby/stdlib/net/http.rb:938 | |
do_start at /usr/local/ruby/jruby-9.1.13.0/lib/ruby/stdlib/net/http.rb:868 | |
start at /usr/local/ruby/jruby-9.1.13.0/lib/ruby/stdlib/net/http.rb:857 | |
start at /usr/local/ruby/jruby-9.1.13.0/lib/ruby/stdlib/net/http.rb:585 | |
get_response at /usr/local/ruby/jruby-9.1.13.0/lib/ruby/stdlib/net/http.rb:480 | |
get at /usr/local/ruby/jruby-9.1.13.0/lib/ruby/stdlib/net/http.rb:457 | |
<main> at -e:1 |
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
ruby_build $ KITCHEN_LOCAL_YAML=.kitchen.dokken.yml bundle exec kitchen test default-centos-6 | |
-----> Starting Kitchen (v1.17.0) | |
-----> Cleaning up any prior instances of <default-centos-6> | |
-----> Destroying <default-centos-6>... | |
Deleting kitchen sandbox at /Users/austinheiman/.dokken/kitchen_sandbox/8db929f748-default-centos-6 | |
Deleting verifier sandbox at /Users/austinheiman/.dokken/verifier_sandbox/8db929f748-default-centos-6 | |
Finished destroying <default-centos-6> (0m0.03s). | |
-----> Testing <default-centos-6> | |
-----> Creating <default-centos-6>... | |
Creating kitchen sandbox at /Users/austinheiman/.dokken/kitchen_sandbox/8db929f748-default-centos-6 |
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
gfixup() { | |
set -x | |
git add --all | |
git commit --fixup=$(git log --oneline | head -1 | cut -d ' ' -f 1) | |
git rebase --interactive HEAD~2 --autosquash | |
set +x | |
local branch_name=$(git symbolic-ref -q HEAD) | |
branch_name=${branch_name##refs/heads/} | |
branch_name=${branch_name:-HEAD} |
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
$ echo_and_run() { echo "$(date +%T) $*"; $*; } | |
$ echo_and_run ls | |
# 15:09:35 ls | |
# Gemfile Gemfile.lock README.md spec |