Skip to content

Instantly share code, notes, and snippets.

@floehopper
floehopper / Gemfile
Last active August 29, 2015 13:55
Teardown sequence for Mocha / MiniTest / ActiveSupport
source 'https://rubygems.org'
gem 'activesupport'
gem 'mocha'
# example 1
class Foo; end
def Foo.bar; end
# example 2
class Foo
def self.bar; end
end
@floehopper
floehopper / videojs-test-output.txt
Created April 4, 2014 11:49
Building and running video.js tests
$ npm install
# output ommitted for brevity
$ grunt
# output ommitted for brevity
$ grunt test
Running "jshint:src" (jshint) task
$ npm install
# output ommitted for brevity
$ grunt mxmlc
Running "mxmlc:videojs_swf" (mxmlc) task
File "dist/video-js.swf" created.
Done, without errors.
jamesmead@floehopper.local:~/Code/videojs/video-js-swf:master$ grunt connect:dev

Keybase proof

I hereby claim:

  • I am floehopper on github.
  • I am floehopper (https://keybase.io/floehopper) on keybase.
  • I have a public key whose fingerprint is B10D 919D E3B2 3B55 8FF3 80E1 CD75 D7BD 899B 8102

To claim this, I am signing this object:

*** Exception NameError in PhusionPassenger::Rack::ApplicationSpawner (undefined method `ssl?' for class `Sinatra::Request') (process 21881, thread #<Thread:0x7f7c50c932d0>):
from /home/webhooks/app/vendor/gems/ruby/1.8/gems/sinatra-1.4.5/lib/sinatra/base.rb:49
from /home/webhooks/app/vendor/gems/ruby/1.8/gems/sinatra-1.4.5/lib/sinatra.rb:1:in `require'
from /home/webhooks/app/vendor/gems/ruby/1.8/gems/sinatra-1.4.5/lib/sinatra.rb:1
from ./app.rb:5:in `require'
from ./app.rb:5
from config.ru:1:in `require'
from config.ru:1
from /usr/lib/ruby/1.8/rack/builder.rb:46:in `instance_eval'
from /usr/lib/ruby/1.8/rack/builder.rb:46:in `initialize'
@floehopper
floehopper / patches-for-rails-and-rack-for-argument-error-invalid-byte-sequence.rb
Last active August 29, 2015 14:10
Patches for Rails and Rack for ArgumentError: invalid byte sequence
# Based on these Rack commits [1,2] which originated from this Rack PR [3] and
# mentioned in this Rails PR [4].
#
# [1]: https://github.com/rack/rack/commit/cc8279f4a158e51975838e6202581c3d5e33f1c4
# [2]: https://github.com/rack/rack/commit/975ccac7e56dcd765cb102016b97ef13d15feba8
# [3]: https://github.com/rack/rack/pull/713
# [4]: https://github.com/rails/rails/pull/11795
require 'rack/utils'
@floehopper
floehopper / handle-google-apps-invoice.js
Created May 2, 2015 14:55
Spike on automatically saving Google Apps invoice attachment from Gmail into Google Drive using Google App Script
function myFunction() {
var threads = GmailApp.search("label:inbox subject:'Google Enterprise: Your invoice is attached'");
for (var threadIndex = 0 ; threadIndex < threads.length; threadIndex++) {
var messages = threads[threadIndex].getMessages();
if (messages.length == 0) {
Logger.log('No messages found in thread.');
return;
}
var message = messages[0];
var attachments = message.getAttachments();
@floehopper
floehopper / rendering-date-questions.md
Created May 12, 2015 11:33
Smart Answer - Rendering Date Questions

Smart Answer Flows

Question

show.html.erb
  _content.html.erb
    _current_question.html.erb
      ::QuestionPresenter#partial_template_name
        _date_question.html.erb

::DateQuestionPresenter (undefined)

@floehopper
floehopper / Gemfile
Last active August 29, 2015 14:23 — forked from chrisroos/Gemfile
source 'https://rubygems.org'
gem 'minitest'
gem 'webmock'