Skip to content

Instantly share code, notes, and snippets.

View johnreilly's full-sized avatar

John Reilly johnreilly

View GitHub Profile
@johnreilly
johnreilly / association_scope_enum_test.rb
Last active May 2, 2017 15:09
Rails 5.1 association scope test
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"
# gem "rails", '= 5.0.2'
@johnreilly
johnreilly / keybase.md
Created September 18, 2014 15:55
keybase.md

Keybase proof

I hereby claim:

  • I am johnreilly on github.
  • I am johnreilly (https://keybase.io/johnreilly) on keybase.
  • I have a public key whose fingerprint is 3AC1 A09A E319 2FDA 8156 1226 DB72 7DDF E1B7 D06A

To claim this, I am signing this object:

@johnreilly
johnreilly / postgis-1.5.7.patch
Created November 1, 2012 20:14
Patching homebrew/versions postgis15 to use postgis 1.5.7
From 51bd994764fdd881d6a9a8bc238ed24777454595 Mon Sep 17 00:00:00 2001
From: John Reilly <[email protected]>
Date: Thu, 1 Nov 2012 15:20:14 -0500
Subject: [PATCH] updating to postgis-1.5.7
---
postgis15.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/postgis15.rb b/postgis15.rb
# gem install sinatra sinatra-contrib icalendar
require 'sinatra'
require "sinatra/reloader" if development?
require 'icalendar'
require 'date'
get '/schedule.ics' do
cal = Icalendar::Calendar.new
@johnreilly
johnreilly / gist:948724
Created April 29, 2011 18:02
Mount rails app in rack cascade
#This is psudocode, but should be an okay example...
# Step 1: require rails' environment
require 'path/to/config/environment'
# Step 2: add rails app to cascade:
run Rack::Cascade.new([
rack_app1,
MyRailsApp::Application, # Place rails in the cascade where you need it
['net/http', 'json'].each {|lib| require lib}; def payout bet; 13 == JSON.parse(Net::HTTP.get 'roulette.engineyard.com', '/')['winning_number'].to_i ? bet * 35 : 0; end
@johnreilly
johnreilly / SubViews.html
Created December 2, 2010 18:19
My attempt at using Backbone.js views to render other "sub-views"
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/underscore.js" type="text/javascript"></script>
<script src="js/backbone.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
$(function(){
#
# Cookbook Name:: nodejs
# Recipe:: default
#
if ['solo'].include?(node[:instance_role])
nodejs_file = "node-v0.1.101.tar.gz"
nodejs_dir = "node-v0.1.101"
nodejs_url = "http://nodejs.org/dist/#{nodejs_file}"
#
# Cookbook Name:: delayed_job
# Recipe:: default
#
if ['solo', 'app', 'app_master'].include?(node[:instance_role])
run_for_app("your_app_name_here") do |app_name, data|
ey_cloud_report "delayed_job" do
# File: test_helper.rb
class ActiveSupport::TestCase
...
end
### Stub out post-processing on each class that uses paperclip
### (Uses an application configuration to turn on the slow processing again, if desired.)
if APP_CONFIG[:override_paperclip_processing]
[Canvas, Message, PictureAsset, User].each do |klass|