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
body { | |
font: 16px 'Open Sans', sans-serif; | |
color:black; | |
line-height:1.2em; | |
background-color: #FFFFFF; | |
padding: 0.7em; | |
} | |
p { | |
margin:1em 0 1em 1.2em; | |
line-height:1.5em; |
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(rspec active_record sqlite3 pry-byebug).each {|gem| require gem } | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:database => ':memory:' ) | |
class CreateTestDB < ActiveRecord::Migration[5.2] | |
def self.up | |
create_table :foos do |t| | |
t.string :name |
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
AllCops: | |
TargetRubyVersion: 2.2 | |
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop | |
# to ignore them, so only the ones explicitly set in this file are enabled. | |
DisabledByDefault: true | |
Exclude: | |
- '**/templates/**/*' | |
- '**/vendor/**/*' | |
- 'actionpack/lib/action_dispatch/journey/parser.rb' |
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
kylo [2.4.1] [~] ➜ cat bin/newrailsapp.sh | |
#!/bin/bash | |
set -e | |
app=$1 | |
approot=$HOME/box/$1 | |
# create a new rails app with my usuals | |
cd $HOME/box |
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 Foo | |
def repeat | |
2.times { repeated } | |
end | |
def repeated; end | |
end | |
describe Foo do | |
let(:foo) { stub method1:"hello" } |
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 Goodie | |
attr_accessor :price | |
def initialize(price) | |
@price = price | |
end | |
def accept(visitor) | |
visitor.visit(self) | |
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
def foo(with:"default", delegate:String, selector:"to_s") | |
puts "with: #{with}" | |
puts "delegate: #{delegate.class.to_s}" | |
puts "result: #{delegate.send(selector)}" | |
end | |
def bar; puts "hello from Bar";end | |
foo with:"Joon", delegate:self, selector:"bar" |
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' | |
class Victim | |
def called_name | |
caller_name = caller[0].scan(/\`.*\'/).first.gsub(/\`|\'/,"") rescue "outside of self" | |
if caller_name =="my_caller" | |
"looks like it's called from my_caller" | |
else | |
"who's calling me? #{caller_name} is" | |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redis-server - Persistent key-value db |
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 | |
# | |
if $*.size < 1 | |
puts "usage: rename \"{file search criteria}\" pattern replacement" | |
puts "example: rename \"*\" .MOV .mov" | |
puts " this changes the .MOV to .mov in all files in current directory" | |
else | |
files = Dir.glob "#{$*[0]}" | |
files.each do |f| |
NewerOlder