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_relative 'libfax' | |
puts "Sending fax..." | |
attempts = mock_fax('555-555-5555', "Here's a fax!") | |
attempts.each_with_index do |status, i| | |
case status | |
when :sent | |
puts "Fax sent!" | |
break | |
when :busy |
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 'sinatra' | |
CLIPBOARD = ENV['CLIPBOARD'] || '/tmp/www-clipboard' | |
get '/' do | |
@data = File.readlines(CLIPBOARD) rescue [] | |
erb :form | |
end | |
post '/paste' do | |
unless params[:data].to_s.empty? |
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 'securerandom' | |
module Sidekiq | |
class CsrfTokenFix | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) |
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/bash | |
find $@ -type f -print0 | wc -l --files0-from=- |
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 fizzbuzz(input) | |
input.map do |n| | |
fizz = n % 3 == 0 ? 'Fizz' : nil | |
buzz = n % 5 == 0 ? 'Buzz' : nil | |
if fizz or buzz | |
"#{fizz}#{buzz}" | |
else | |
n.to_s | |
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
require './main' | |
run API::Root |
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
#dropbox { | |
position: relative; | |
} | |
#dropbox > input { | |
position: absolute; | |
top: 0px; | |
right: 0px; | |
bottom: 0px; | |
left: 0px; |
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
/* | |
* ManagedWebSocket is a thin wrapper around WebSocket that handles automatic reconnecting and re-binding. | |
* If the server/network drops the connection, it will keep trying to reconnect. However, you may call | |
* "kill" to permanently disconnect on the client side. The native WebSocket object is available as "ws". | |
* | |
* Use "on" to bind to normal WebSocket events (open, message, error, close), and to the following custom events: | |
* - connecting: Fired when it is attempting to connect or reconnect. | |
* - drop: Fired when the connection has been dropped by the server or network. (fired before "close") | |
* - kill: Fired when you call "kill" on the MWS. (fired before "close") | |
* |
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
Capybara.javascript_driver = :webkit # Selenium works, but not as well | |
RSpec.configure do |config| | |
config.use_transactional_fixtures = false | |
# Use transactions by default | |
config.before :each do | |
DatabaseCleaner.strategy = :transaction | |
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
source 'https://rubygems.org' | |
gem 'activerecord', '~> 5.2', require: 'active_record' | |
gem 'sqlite3' | |
gem 'rake' |
OlderNewer