Skip to content

Instantly share code, notes, and snippets.

View barelyknown's full-sized avatar

Sean Devine barelyknown

View GitHub Profile
@barelyknown
barelyknown / the_talk_show_64_google_transcription.txt
Last active December 31, 2015 09:09
Google speech-to-text transcription of Episode 64 (One Star) of The Talk Show with John Gruber and Daniel Jalkut. Transcribed in 5 second chunks.
how much does my mouth almost lost my fingertips I yesterday because I
decided to run with I
glove wear post literally thinking
how about a mile and a half for my home I should have gotten
computer programmer fingertip insurance b****
idle problems riding my dick finger injury 2 years ago just one
finger is martyr think you're going to poster
become an expert in the speech recognition systems
free pad thai
never really thought about it but its gotta be the worst of the worst use case for
@barelyknown
barelyknown / histogram_by_letter.txt
Created December 12, 2013 22:13
Histogram of word count by letter.
a .............
b .............
c ....................
d ............
e ........
f .........
g .......
h .........
i ........
j ..
@barelyknown
barelyknown / gist:7815117
Created December 5, 2013 22:24
out of band garbage collection results
{"RUBY_GC_MALLOC_LIMIT"=>100000000, "RUBY_HEAP_MIN_SLOTS"=>1632000}
starting memory
---
:count: 38
:heap_used: 4183
:heap_length: 4183
:heap_increment: 0
:heap_live_num: 687279
:heap_free_num: 1014369
@barelyknown
barelyknown / to_csv_with_headers.rb
Created November 2, 2013 16:57
additional method for CSV::Rows to convert row to csv with headers. useful for serializing row for Sidekiq jobs.
class CSV::Row
def to_csv_with_headers
CSV.generate do |csv|
csv << headers
csv << fields
end.to_s
end
end
@barelyknown
barelyknown / initialize_as_a_valid_instance_matcher.rb
Created August 24, 2013 19:03
Rspec matcher to test if a class initialize valid instances.
# test if ActiveRecord classes (or ActiveModel) initialize valid instances
# it { should initialize_as_a_valid_instance }
RSpec::Matchers.define :initialize_as_a_valid_instance do
match do |actual|
actual.valid?
end
description do
@barelyknown
barelyknown / http_request_through_proxy_in_ruby.rb
Created January 20, 2013 23:43
HTTP request through a proxy in ruby
http_class = Net::HTTP::Proxy(proxy_url, proxy_port, proxy_user, proxy_password)
http_class.start("example.com", 80) do |http|
request = Net::HTTP::Get.new "/hello_world.html"
request["Example-Header"] = "patriots_will_win_by_14"
http.request(request).body
end
@barelyknown
barelyknown / partage_api_terms.txt
Last active December 10, 2015 01:38
Partage API Terms
The price provided in this rate quote response specifically reflects the origin and destination zip codes provided, the equipment type selected, as well as the number of pallet spots (defined as a standard 4' x 4' pallet, occupying space from the floor of the trailer to the ceiling of the trailer), and the weight of the shipment in the case of partial truckload shipments. Partial truckload shipments must be at least 4 pallets and 4,000 pounds and must be palletized. Product that is not palletized must move as a full truckload. This price is dependent on the exact pickup and delivery dates of the shipment. If no pickup date was entered as part of the quote process, or if the pickup and delivery date entered in the quote changes for any reason, the price of the shipment may change. This price reflects the special services that were selected in the quote. Special services not selected in the quote but required as part of the shipment's handling, will be charged according to Partage's standard accessorial rate sc
@barelyknown
barelyknown / Partage API README.md
Last active December 10, 2015 01:38
Partage API Documentation

THE LATEST VERSION OF THIS DOCUMENTATION IS AVAILABLE AT gopartage.com/api.

Partage API

The Partage API provides a simple limited interface to the Partage brokerage system.

Authentication

For now, authentication is done with an API token that is connected to your company. We will add additional and more secure authentication options later in 2013 when we expose more services. For now, the services are "read only" and do not enable you to make any changes in our system, so we delayed our decision about additional security until we need to make it.

@barelyknown
barelyknown / optimize-roster-3.js
Created December 9, 2015 16:28
optimize-roster-3.js
function setSolution(solution) {
// for each player
for (var row = 1; row <= PLAYERS.getNumRows(); row++) {
var playerId = PLAYERS.getCell(
row,
PLAYERS_PLAYER_COLUMN
).getValue();
// set the selected column based on the optimization solution
PLAYERS.getCell(
@barelyknown
barelyknown / optimize-roster-2.js
Created December 9, 2015 16:26
optimize-roster-2.js
function addSalaryCapConstraint(engine) {
// add a constraint for the overall salary cap
var salaryCapConstraint = engine.addConstraint(0, SALARY_CAP);
// for each player
for (var row = 1; row <= PLAYERS.getNumRows(); row++) {
var player = PLAYERS.getCell(
row,
PLAYERS_PLAYER_COLUMN
).getValue();