Skip to content

Instantly share code, notes, and snippets.

View brandonweiss's full-sized avatar
🏄‍♂️
Surfing or thinking about surfing

Brandon Weiss brandonweiss

🏄‍♂️
Surfing or thinking about surfing
View GitHub Profile
@brandonweiss
brandonweiss / cee_ess_vee.rb
Last active December 1, 2023 04:21
CeeEssVee - quickly output a CSV
require "csv"
class CeeEssVee
def initialize(objects)
@objects = objects
@columns = {}
end
def method_missing(method_name, *args, &block)
@brandonweiss
brandonweiss / rubocop.rb
Last active September 20, 2018 12:23
RuboCop hack for inline-disabling cops
#!/usr/bin/env ruby
def with_captured_stdout
old_stdout = $stdout
$stdout = StringIO.new
yield
$stdout.string
ensure
$stdout = old_stdout
end
@brandonweiss
brandonweiss / index.html
Created October 19, 2017 05:21
Spacer divs
<!DOCTYPE html>
<html lang="en">
<body>
<div style="height: 2rem;" %>
<header>
</header>
@brandonweiss
brandonweiss / keybase.md
Created October 30, 2014 21:04
keybase.md

Keybase proof

I hereby claim:

  • I am brandonweiss on github.
  • I am brandonweiss (https://keybase.io/brandonweiss) on keybase.
  • I have a public key whose fingerprint is 861C 4A8F F1D6 2C07 9797 A3DA 2075 2CCE 64ED 8FA9

To claim this, I am signing this object:

require 'rubygems'
require 'bundler'
Bundler.require(:default, ENV['RACK_ENV'].to_sym)
task :environment do
require './environment'
require './arrival'
end
namespace :db do
desc 'Load the seed data from db/seeds.rb'
task :seed => :environment do
seed_file = File.join(File.dirname(__FILE__), 'db', 'seeds.rb')
load(seed_file) if File.exist?(seed_file)
#! /usr/bin/env ruby
code = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatwehere
# Use Hpricot to add rel="nofollow" to anchor links before output
require 'hpricot'
def add_nofollow(body)
body = Hpricot(body)
a_elements = body.search('a')
unless a_elements.blank?
a_elements.each do |a|
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json