Skip to content

Instantly share code, notes, and snippets.

View hbarrington's full-sized avatar
💭
Exploring a new side-project (let's do some scraping!)

Hunter Barrington hbarrington

💭
Exploring a new side-project (let's do some scraping!)
  • Bestgate Engineering
  • Baltimore, MD / Washington DC
View GitHub Profile
@hbarrington
hbarrington / awesome-nginx.conf
Created December 29, 2016 14:53 — forked from vjt/awesome-nginx.conf
*AWESOME* nginx configuration for Ruby/Rack web applications
#
# mmm m m mmm mmm mmm mmmmm mmm
# " # "m m m" #" # # " #" "# # # # #" #
# m"""# #m#m# #"""" """m # # # # # #""""
# "mm"# # # "#mm" "mmm" "#m#" # # # "#mm"
#
# nginx configuration For Ruby/Rack web applications
#
# Cooked up with style, care and a bit of *secret*
# nerdy spice. :-)
class AppBuilder < Rails::AppBuilder
include Thor::Actions
include Thor::Shell
def test
append_test_gems
rspec
cucumber
end
require 'benchmark'
5.times do |i|
i = 10 ** i
h = Hash[i.times.map { |z| [z, z] }]
puts "N KEYS: #{i}"
puts
Benchmark.bm do |x|
x.report('dup') { 1000.times { h.dup } }
@hbarrington
hbarrington / app.rake
Created July 9, 2012 17:35 — forked from ChuckJHardy/app.rake
Rake Task for Database Population
------------ From Rake Task
namespace :app do
# Checks and ensures task is not run in production.
task :ensure_development_environment => :environment do
if Rails.env.production?
raise "\nI'm sorry, I can't do that.\n(You're asking me to drop your production database.)"
end
end
@hbarrington
hbarrington / adsense_helper.rb
Created June 12, 2012 19:43 — forked from defkode/adsense_helper.rb
Google Adsense Rails 3 helper
module AdsenseHelper
# Author: Tomasz Mazur (defkode@gmail.com)
# http://www.mydigitallife.info/2009/01/17/google-adsense-legacy-old-generation-code-reference-generate-and-get/
# :slot
# :theme
# :background
# :border
# :link
# :text