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 bash | |
# usage: file-contains-in-x-lines matchy path/to/file | |
# Check if single file contains "matchy" in the first 10 lines | |
head -n 10 $2 | grep -m 1 $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
map <silent> <Leader>rl :w<cr>:silent call RunCurrentLineInTest('!ts bundle exec rspec')<cr>:silent redraw!<cr> | |
map <silent> <Leader>rt :w<cr>:silent call RunCurrentTest('!ts bundle exec rspec')<cr>:silent redraw!<cr> | |
" Test runner helpers | |
function! RunCurrentTest(rspec_type) | |
let in_test_file = match(expand("%"), '\(.feature\|_spec.rb\|_test.rb\)$') != -1 | |
if in_test_file | |
call SetTestFile() | |
if match(expand('%'), '\.feature$') != -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
#!/usr/bin/env ruby | |
require "rpi_gpio" | |
# Set up a color table in Hexadecimal | |
COLOR = [ | |
0xFF0000, # red | |
0x00FF00, # green | |
0x0000FF, # blue | |
0xFFFF00, # yellow |
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 | |
require "rpi_gpio" | |
# Set #18 as LED pin | |
LED_PIN = 18 | |
puts "========================================" | |
puts "| Breath LED |" | |
puts "| ------------------------------ |" |
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 | |
require "rpi_gpio" | |
LED_PINS = [17, 18, 27, 22, 23, 24, 25, 4] | |
puts "========================================" | |
puts "| 8 LEDs |" | |
puts "| ------------------------------ |" | |
puts "| LED0 connect to GPIO0 |" |
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 | |
require "rpi_gpio" | |
# Set #17 as LED pin | |
LED_PIN_NUMBER = 17 | |
puts "========================================" | |
puts "| Blink LED |" | |
puts "| ------------------------------ |" |
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
# frozen_string_literal: true | |
module Performance | |
LOGGER = ActiveSupport::TaggedLogging.new(Logger.new(Rails.root.join("log", "performance.log"))) | |
class LogSubscriber < ActiveSupport::LogSubscriber | |
def logger | |
LOGGER | |
end | |
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
# Use a pre-defined workflow | |
use "FlatMergeWorkflow" | |
# Do something before the `start` command | |
before :start do | |
say "Booya! Started this bad girl." | |
end | |
# Do something after the `deliver` command | |
after :deliver do |
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 User < ApplicationRecord | |
has_many :dogs | |
end | |
class Dog < ApplicationRecord | |
belongs_to :user | |
end |
NewerOlder