Skip to content

Instantly share code, notes, and snippets.

View redsquirrel's full-sized avatar
🐿️

Dave Hoover redsquirrel

🐿️
  • Flexa, Inc.
  • Evanston, IL
  • 08:33 (UTC -05:00)
  • X @davehoover
View GitHub Profile
@redsquirrel
redsquirrel / linkedin_api_search.rb
Created April 30, 2014 17:49
Trying (and failing) to use the LinkedIn Search API
require 'rubygems'
require 'linkedin'
client = LinkedIn::Client.new('75abcxm123himom', 'NDwtffWomglylolV')
request_token = client.request_token({}, :scope => "r_network")
rtoken = request_token.token
rsecret = request_token.secret
@redsquirrel
redsquirrel / cs-man-of-the-year.txt
Created February 18, 2015 04:17
The first ever Computer Science "Man of the Year"
The first ever Computer Science "Man of the Year"...
...had a PhD in mathematics from Yale, and was a professor of math.
...joined the Navy at age 37 to help with World War II.
...learned to program as one of the original programmers of the Mark 1 at Harvard, which was instrumental in
completing the Manhatten project.
...became the Head of Software at the first computer-focused tech startup, which created the first popular
@redsquirrel
redsquirrel / kyle-report.md
Last active August 29, 2015 14:17
Apprenticeship Program experience report

Hello Dave,

I wanted to thank you for the white paper you gave me when I reached out while starting our apprenticeship program at my company and share the results of the program with you. We took on 3 apprentices for our program and the program went really well and we've hired all 3 as full time developers.

We got to train 3 people in our processes and business, they all contributed to projects during the program and at the end we had 3 new hires that were ready to go day one, who we knew could perform since they had already been contributing and had been trained in everything we wanted them to know. We've had a hard time hiring people in the past and this just went so smoothly -- even the time investment wasn't as bad as I budgeted for, really early in the program they were able to contribute small units of work to the point that my time investment was recouped by the work they were contributing back.

The way we modeled the program wa

redsquirrel:~ davehoover$ irb
2.0.0-p451 :001 > a = ['foo']
=> ["foo"]
2.0.0-p451 :002 > b = a
=> ["foo"]
2.0.0-p451 :003 > b += ['bar']
=> ["foo", "bar"]
2.0.0-p451 :004 > a
=> ["foo"]
2.0.0-p451 :005 >
> Date.today
=> Tue, 25 Aug 2015
> Time.at(Date.today.to_datetime.to_i).to_date
=> Mon, 24 Aug 2015
class CarController < ApplicationController
def car
layout = nil
@scripts = []
@stylesheets = []
@car = Car.find(params[:id])
layout = CarPresenter.present(@car, @stylesheets, @scripts)
render :action => find_view, :layout => layout
##
# HACKER: Dave Hoover
#
# AUTHORS: Geoffrey Grosenbach http://nubyonrails.com
# Also http://p.ramaze.net/1887
#
# RUN:
# script/console
# paste the following and make sure an exception is thrown
# Bad old stuff
class KDOrders < ActiveRecord::Base
belongs_2 :cart
end
class Cart < ActiveRecord::Base
set_primary_key "cart_id"
can_haz :cart_items
end
class CartItem < ActiveRecord::Base
set_primary_key "cart_item_id"
arr = [1,1,2,2,3,3,4,5]
require 'set'
dups = Set.new
arr.each_with_index { |n, i| dups << n if n == arr[i+1] }
dups # [1, 2, 3]
# Using ActiveRecord's trunk as of Oct 3, 2008, this fails with
# active_record/connection_adapters/abstract/connection_pool.rb:158:in `checkin': undefined method `run_callbacks' for nil:NilClass (NoMethodError)
config = {
:adapter => "mysql",
:host => "localhost",
:username => "root",
:database => "jackgroundrb_development"
}