Say you normally use the great database_cleaner
gem. Per the README
the standard setup is:
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
FactoryGirl.define do | |
factory :user do | |
email 'myuser@test.com' | |
password 'this IS a BAd passowrds1234!!' | |
trait :confirmed do | |
confirmed_at { Time.now } | |
confirmation_token nil | |
end |
"Words" * 2 | |
# => "WordsWords" | |
2 * "Words" | |
# TypeError: String can't be coerced into Fixnum | |
# Oops what just happened? | |
# In Ruby, virtually everything is a message to another object. | |
# Above we would say: |
#!/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 |
#!/usr/bin/env ruby | |
# | |
# Little ditty to untar a bunch of mongo bson dumps, | |
# and then restore them. | |
# | |
# Remembers if something was processed before and doesn't | |
# process it again. (Though mongo will basically due this | |
# for you 😬) | |
# | |
# I'm a bad person and I should feel bad for writing this |
Say you normally use the great database_cleaner
gem. Per the README
the standard setup is:
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
cat_with_name() { for i in $* ; do echo ; echo "=== $i ===" ; cat $i ; done } |
CHRUBY_VERSION="0.3.8" | |
RUBIES=() | |
for dir in "$PREFIX/opt/rubies" "$HOME/.rubies"; do | |
[[ -d "$dir" && -n "$(ls -A "$dir")" ]] && RUBIES+=("$dir"/*) | |
done | |
unset dir | |
function chruby_reset() | |
{ |
require "benchmark" | |
require "benchmark/ips" | |
def arr | |
Array.new(1_000, 1) | |
end | |
def arr_of_arrs | |
Array.new(1_000){ (1..1000).to_a } | |
end |
!!
Repeat Previous Command!-1
Repeat Previous Command!-2
Repeat 2nd Previous Command!ps
Execute Previous Command STARTING WITH ps!^
First Argument From Previous Command!:2
2nd Argument From Previous Command!$
Last Argument From Previous Command!!:$
Last Argument From Previous CommandFeature: Testing Code Blocks | |
In the feature description. | |
Only indent to specify code block: | |
No indent: | |
/a regex/ | |
a_string = "foo" |