Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fletcherm's full-sized avatar

Matt Fletcher fletcherm

View GitHub Profile
public byte[] ReadModelNumber() {
var loader = new HidDeviceLoader();
var device = loader.GetDevices(0x1234, 0x9876).First();
HidStream stream;
device.TryOpen(out stream);
var message = new byte[] { 0, 0xaa };
stream.Write(message);
return stream.Read();
}
def self.playlist_id
SystemConfiguration.youtube.playlist.id
end
# or
config.api_key = SystemConfiguration.airbrake.api_key
# or
#!/usr/bin/env ruby
require 'pathname'
module TestProductionDataImportToFedora
module_function
def go(dir)
source_dir = find_source dir
validate_running_from_rails_root
reset_everything
#!/usr/bin/env expect
spawn $env(FEDORA_HOME)/server/bin/fedora-rebuild.sh
expect "Enter (1-3) --> " { send "1\r" }
expect "Enter (1-2) --> " { send "1\r" }
interact
module MakeFirefoxLaunchInBackground
module_function
def run
webdriver_path = `bundle show selenium-webdriver`.chomp
launcher_path = "#{webdriver_path}/lib/selenium/webdriver/firefox/launcher.rb"
if !File.exist?(launcher_path)
raise "Couldn't find the Firefox launcher file at [#{launcher_path}]."
end
expected_launch_line = '@binary.start_with @profile, @profile_dir, "-foreground"'
@fletcherm
fletcherm / dashboard_spec.rb
Created December 26, 2012 19:13
capybara-screenshot and RSpec configuration
scenario 'closing the map and looking at it later', screenshot: true do
# ...
end
# 8/16/2012
# This is here specifically for font awesome. It causes QT and capybara-webkit
# to crash while trying to load the font.
# If you are aware of any better way to take care of this problem, let
# me know!
if Rails.env.test?
Rails.application.config.assets.paths.reject! { |path| path.to_s =~ /fonts/ }
end
desc 'Continuous integration task'
task ci: %w[ ci:prepare file_store:clear db:migrate ] do
exec({ 'RAILS_ENV' => nil }, 'rake', 'spec', 'spec:javascripts')
end
class SessionsController < Devise::SessionsController
before_filter only: :new do
params.delete(:user)
end
end
class AcademicServicesRouter extends Backbone.Router
routes:
'records': 'records'
'financial_aid': 'financial_aid'
'admissions': 'admissions'
initialize: ({@view}) =>
@view.bind 'records_selected', => @navigate('/records', true)
@view.bind 'financial_aid_selected', => @navigate('/financial_aid', true)
@view.bind 'admissions_selected', => @navigate('/admissions', true)