Skip to content

Instantly share code, notes, and snippets.

View doolin's full-sized avatar

Dave Doolin doolin

View GitHub Profile
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'active_record'
require 'rspec/autorun'
require 'pg'
require 'byebug'
# Extend for effect
class String
<mxfile host="Electron" modified="2022-03-13T20:44:33.536Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.110 Electron/16.0.7 Safari/537.36" etag="R_SOdd2db7crDnFWafUC" version="16.5.1" type="device"><diagram id="qbLhw_JT5a_EEhQz4K1e" name="Page-1">7Z1td5s2GIZ/jT+6B8T7x8Zu2q5zt9Ns67pvxMg2C0YM48TJr59kwDE8yolpjBBGaY9DBAis5/ItcevFI2Oy3n1M/WQ1IwGORkgLdiNjOkJINxEasf9a8JinuKaXJyzTMCgOek64CZ9wkagVqdswwJvKgRkhURYm1cQ5iWM8zyppfpqSh+phCxJVr5r4SwwSbuZ+BFO/h0G2KlJ1TXve8QmHy1Vxadcqdtz687tlSrZxcb0RMq73P/nutV/mVRy/WfkBeThKMj6MjElKSJZvrXcTHLGyLYstP+/6hb2H+05xnJ1ywuevH4i5w//Ef3z98vTj753zy/ZuXORy70fbojz+TIrbzR7LIsrwjl7hapWtI5qg000/Cpcx3Z7Ta+OUJtzjNAtpob4vdqzDIGCnX6V4Ez75t/usNPp3QsI424fMuhpZU5bXNiObHAuW9SZLyR2ekIjQfKcxiVkuizCK6kkkzgqadJtdiEUCB8Vl2N5rfx1GjMpv5JZkhL6nGYlJeSrZpnN28irLKGnIMt7TF1p47IUdsHm3JGQZYT8JN+/mZL3fMd/sD71e5FnTzUPmFro6yr68WQqFOWX/aDoMWFn6tPDw7iipCOBHTNY4S+l1tGKvZRj5KcWHrWTx4Zlco0haHTFbIugXn5XlIeNnXuhGgUwDfBDAZ0oeYgWQvAChKkCOAwmyRBJkAIKuSfrgp0EDiCK8yDgI0WL
@doolin
doolin / application.rb
Created August 15, 2020 12:35 — forked from shawndrost/application.rb
Single file Rails application
# the new and improved one-file rails app -- now including
require "action_controller/railtie"
class Tester < Rails::Application
config.session_store :cookie_store, :key => '_rails_session'
config.secret_token = '095f674153982a9ce59914b561f4522a'
end
class UsersController < ActionController::Base
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@doolin
doolin / 15-acme-operations.tf
Created August 8, 2020 18:56 — forked from QuingKhaos/15-acme-operations.tf
Terraform initialization of AWS sub account
// Configure AWS provider
variable "acme_operations" {
default = "ACCOUNTID"
}
provider "aws" {
alias = "acme_operations"
profile = "acme_operations"
region = "${var.aws_default_region}"
shared_credentials_file = "./credentials"
require 'openssl'
require 'base64'
require 'json'
require 'rspec/autorun'
# Example taken from https://en.wikipedia.org/wiki/JSON_Web_Token
class JwtAuth
SECRET = ENV['JWT_TEST_SECRET'] || 'secretkey'
def header
@doolin
doolin / git_abbr.fish
Created August 6, 2019 15:02 — forked from jdiaz5513/git_abbr.fish
Git Abbreviations for Fish
abbr -a -U -- ga 'git add'
abbr -a -U -- gaa 'git add --all'
abbr -a -U -- gbd 'git branch -d'
abbr -a -U -- gbl 'git branch -l'
abbr -a -U -- gbm 'git branch -m'
abbr -a -U -- gc 'git commit'
abbr -a -U -- gc! 'git commit --amend'
abbr -a -U -- gcam 'git commit --all -m'
abbr -a -U -- gcan! 'git commit --all --no-edit --amend'
abbr -a -U -- gcb 'git checkout -b'
@doolin
doolin / pre-push.sh
Created July 24, 2019 21:07 — forked from kirkelifson/pre-push.sh
good git hooks for rails
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
print_fuck() {
echo "${RED}"
echo " █████▒█ ██ ▄████▄ ██ ▄█▀"
echo "▓██ ▒ ██ ▓██▒▒██▀ ▀█ ██▄█▒ "
echo "▒████ ░▓██ ▒██░▒▓█ ▄ ▓███▄░ "
echo "░▓█▒ ░▓▓█ ░██░▒▓▓▄ ▄██▒▓██ █▄ "

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

#!/usr/bin/env ruby
# invoke with ./generated_example.rb -f d
require 'rspec/autorun'
public
def solution(args)
# code here
end