Skip to content

Instantly share code, notes, and snippets.

Avatar

Bob Lail boblail

View GitHub Profile
@boblail
boblail / lily.js
Last active May 5, 2020
Amazon's Angular app for v1 of the CCP
View lily.js
(function() {
angular
.module("ccpModule", ["ngRoute", "ngAnimate", "ngResource"])
.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl: "index.html",
controller: "MainController"
})
.when("/dialPad", {
@boblail
boblail / lily.js
Created May 5, 2020
Amazon's Angular app for v1 of the CCP
View lily.js
(function() {
angular
.module("ccpModule", ["ngRoute", "ngAnimate", "ngResource"])
.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl: "index.html",
controller: "MainController"
})
.when("/dialPad", {
@boblail
boblail / after_restart.rb
Created Jan 14, 2014
Configuring an EngineYard Deploy Hook to notify Houston
View after_restart.rb
if %w{solo app_master}.member? config.current_role
app = config.current_path[/(?<=\/data\/)([^\/]+)(?=\/)/]
env = ENV["RAILS_ENV"]
sha = File.read("#{config.current_path}/REVISION").chomp
require 'net/http'
require 'uri'
uri = URI("http://status.cphepdev.com/projects/#{app}/deploy/#{env}")
configuration = config.configuration
@boblail
boblail / errbit.rb
Last active Jan 2, 2016
Configure Airbrake to inform Errbit of GIT_COMMIT
View errbit.rb
Airbrake.configure do |config|
# ...
config.user_attributes = %w{id email} # the default is just 'id'
config.async = true # requires the gem 'sucker_punch' and 'airbrake ~> 3.1.15'
end
# Inform Errbit of the version of the codebase checked out
GIT_COMMIT = ENV.fetch('COMMIT_HASH', `git log -n1 --format='%H'`.chomp).freeze
@boblail
boblail / ledger.md
Last active Jan 2, 2016
Refactor List
View ledger.md

Ledger Refactors

  • Stop passing so many arguments to the TransactionEntry directive:
    • accounts and fiscalYears, at least, can be derived from root scope
  • Global months
  • Don't use expand and collapse methods
  • Nodes have both isAccount and resourceType
@boblail
boblail / sql_rocket
Last active Dec 17, 2015
Exports a MySQL database as XML, walks the XML stream with nokogiri, and outputs well-formed Postgres SQL
View sql_rocket
#!/usr/bin/env ruby
# encoding: utf-8
# https://gist.github.com/boblail/5587579
require 'benchmark'
require 'nokogiri'
require 'progressbar'
require 'tempfile'
class SqlRocket < Nokogiri::XML::SAX::Document
View pdftk.rb
require 'formula'
class Pdftk < Formula
url 'http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-1.44-src.zip'
homepage 'http://www.pdflabs.com/'
md5 '9eb50fffcd621a627d387750c60982b4'
# depends_on 'gcc' # with "--enable-java" option , required "Homebrew-alt" .
# via : https://github.com/adamv/homebrew-alt/
def install
@boblail
boblail / gist:2731915
Created May 19, 2012
A/B Testing; DDD
View gist:2731915
@boblail
boblail / find_easter.cs
Created Apr 25, 2011
Calculate the date of Easter given the year
View find_easter.cs
public static DateTime FindEaster( int year ) {
int month, day, century, n, m, i, j, k, z, a, l;
century = year / 100;
n = year % 19;
m = (century - 17) / 25;
i = century - (century >> 2) - (int)((century - m) / 3) + 19 * n + 15;
j = i % 30;
z = (int)(j / 28);
k = j - z * (1 - z * (int)(29 / (j + 1)) * (int)((21 - n) / 11));
@boblail
boblail / test.rb
Created Feb 26, 2011
Test Google Analytics, new Image, and Zombie
View test.rb
require 'rubygems'
require 'sinatra'
get '/image' do
<<-HTML
<html>
<head>
<title>new Image Test</title>
</head>
<body>
You can’t perform that action at this time.