Skip to content

Instantly share code, notes, and snippets.

View philtr's full-sized avatar

Phillip Ridlen philtr

View GitHub Profile
@philtr
philtr / environment.rb
Last active December 24, 2015 07:49
Environment variable Ruby interface.
module Environment
class Grabber
include Environment
end
module_function
def get(key)
ENV[key.to_s.upcase]
@philtr
philtr / screencapture.rb
Created January 30, 2014 05:03
Save screenshot of a web page headlessly
require 'headless'
require 'selenium-webdriver'
Headless.ly(dimensions: "1920x1200x24") do
driver = Selenium::WebDriver.for :firefox
driver.navigate.to('http://hellohappy.org/beautiful-web-type/')
driver.save_screenshot('tmp/screenshot.png')
end
@philtr
philtr / pre-push.sh
Created August 20, 2014 20:55
Run tests and prompt before git push if they fail
#!/bin/bash
function run_tests {
bundle exec rspec
}
function double_check {
echo -e "\n"
read -p "WARNING: Your tests failed. Are you sure you want to push? " -n 1 -r < /dev/tty
echo
@font-face {
font-family: octicons-anchor;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAYcAA0AAAAACjQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABMAAAABwAAAAca8vGTk9TLzIAAAFMAAAARAAAAFZG1VHVY21hcAAAAZAAAAA+AAABQgAP9AdjdnQgAAAB0AAAAAQAAAAEACICiGdhc3AAAAHUAAAACAAAAAj//wADZ2x5ZgAAAdwAAADRAAABEKyikaNoZWFkAAACsAAAAC0AAAA2AtXoA2hoZWEAAALgAAAAHAAAACQHngNFaG10eAAAAvwAAAAQAAAAEAwAACJsb2NhAAADDAAAAAoAAAAKALIAVG1heHAAAAMYAAAAHwAAACABEAB2bmFtZQAAAzgAAALBAAAFu3I9x/Nwb3N0AAAF/AAAAB0AAAAvaoFvbwAAAAEAAAAAzBdyYwAAAADP2IQvAAAAAM/bz7t4nGNgZGFgnMDAysDB1Ml0hoGBoR9CM75mMGLkYGBgYmBlZsAKAtJcUxgcPsR8iGF2+O/AEMPsznAYKMwIkgMA5REMOXicY2BgYGaAYBkGRgYQsAHyGMF8FgYFIM0ChED+h5j//yEk/3KoSgZGNgYYk4GRCUgwMaACRoZhDwCs7QgGAAAAIgKIAAAAAf//AAJ4nHWMMQrCQBBF/0zWrCCIKUQsTDCL2EXMohYGSSmorScInsRGL2DOYJe0Ntp7BK+gJ1BxF1stZvjz/v8DRghQzEc4kIgKwiAppcA9LtzKLSkdNhKFY3HF4lK69ExKslx7Xa+vPRVS43G98vG1DnkDMIBUgFN0MDXflU8tbaZOUkXUH0+U27RoRpOIyCKjbMCVejwypzJJG4jIwb43rfl6wbwanocrJm9XFYfskuVC5K/TPyczNU7b84CXcbxks1Un6H6tLH9vf2LRnn8Ax7A5WQAAAHicY2BkYGAA4teL
class ApplicationPresenter
# Override this in your presenter
def to_hash
{}
end
def to_json
to_hash.to_json
end
# • - space
# ─┤ - tab
class Thing
─┤def to_hash
─┤─┤some_long_method_call(that,•wraps:•••:across,
─┤─┤••••••••••••••••••••••••••••several:•:lines,
─┤─┤••••••••••••••••••••••••••••and_it:••:has,
─┤─┤••••••••••••••••••••••••••••aligned:•:arguments)
─┤─┤{

Keybase proof

I hereby claim:

  • I am philtr on github.
  • I am philtr (https://keybase.io/philtr) on keybase.
  • I have a public key whose fingerprint is 4949 35F1 0934 A5CB 6239 A7CB 9FCB 499F C2A3 203B

To claim this, I am signing this object:

@philtr
philtr / csv2ofx.rb
Last active October 2, 2018 19:50
Convert CSV to OFX (for my very specialized use case)
#!/usr/bin/env ruby
# encoding: utf-8
#
# csv2ofx
#
# Converts my very specialized use case of CSV dumps from the Ally CashBack card
# to an OFX file that YNAB can import.
#
# Usage:
# csv2ofx INPUT_FILE [OUTPUT_FILE]
@philtr
philtr / configuration.rb
Created January 18, 2017 20:00
OpenStruct-based Configuration Class
class Configuration < OpenStruct
def self.configure(&block)
yield config
end
def self.config
@_configuration ||= new
end
def method_missing(method, *args)

A very silly Markdown document

1 Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus vestibulum ipsum a scelerisque ornare. Proin eu venenatis diam. Proin ac aliquam tellus. Vivamus condimentum nulla id metus semper condimentum. Fusce at arcu sit amet urna placerat elementum id eget neque. Proin efficitur sagittis massa vitae fermentum. Proin lobortis volutpat ipsum in accumsan. Praesent non nulla sed tellus mattis blandit. Ut at interdum purus. Nunc ut tempor felis, et tincidunt nisi. Fusce rhoncus vehicula leo sed congue. Quisque elit purus, scelerisque vitae bibendum id, scelerisque eu libero. Praesent quis pharetra dolor. Nulla fermentum, ex in lobortis tempus, nunc metus placerat odio, nec accumsan erat libero blandit felis.

1.1 Heading

Aliquam vel lacus in arcu tincidunt condimentum. Etiam vulputate metus id cursus dapibus. Nunc vulputate erat nulla, vel fermentum massa feugiat vitae. Quisque viverra eros vel lorem pulvinar, ut euismod tortor venenatis. Donec dapibus i