Skip to content

Instantly share code, notes, and snippets.

View testflyjets's full-sized avatar

Chris McCann testflyjets

View GitHub Profile
@testflyjets
testflyjets / lambda_fn.py
Created February 22, 2017 06:49
AWS Lambda function to scrape FAA N-number data
from __future__ import print_function
import boto3
import json
import urllib2
from bs4 import BeautifulSoup
print('Loading function')
def handler(event, context):
@testflyjets
testflyjets / crucifier.rb
Created January 30, 2015 04:54
RTanque entry from Team Crucifier
class Crucifier < RTanque::Bot::Brain
NAME = 'Crucifier'
include RTanque::Bot::BrainHelper
def tick!
command.speed = RTanque::Bot::MAX_SPEED
nearest = nearest_target()
if (!defined?(@direction))
@direction = 0
$(document).ready ->
$('#search_member').autocomplete(
source: "/autocomplete_search"
minLength: 2
select: (event,ui) ->
$("#search_id").val(ui.item.id)
false
)
.data('autocomplete')?._renderItem = (ul, item) ->
$("<li class='autocomplete-item'></li>")
$("*[data-spinner]")
.on("ajax:before", function(){
$($(this).data('spinner')).show();
})
.on("ajax:complete", function(xhr, status){
$($(this).data('spinner')).hide();
})
link_to_remote(dues.email_link,
:url => send_notices_flight_flight_due_path(@flight, dues),
:before => "Element.show('spinner')",
:complete => "Element.hide('spinner')",
:method => :post,
:confirm => confirm)
link_to(dues.email_link,
send_notices_flight_flight_due_path(@flight, dues),
flight.resource :roster_import, :controller => :import,
:only => [:new, :create],
:member => { :import_csv => :get,
:import_setup => :get,
:match_imports => :get }
resource :roster_import, controller: 'import', only: [:new, :create] do
member do
get 'import_csv'
get 'import_setup'
@testflyjets
testflyjets / apollo_factories
Created December 25, 2013 23:48
FactoryGirl setup
FactoryGirl.define do
factory :flight do
name "Testing"
flt_number 69
contact "Rich Eagledell"
email "[email protected]"
address1 "P.O. Box 2233"
city "MCAS Miramar"
state "CA"
zip "92040"
@testflyjets
testflyjets / tqbox2.mysql.stacktrace
Created January 19, 2012 20:59
Torquebox beta2 stacktrace with Rails app
23:12:40,359 WARN [org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker] (http-talos.dev-127.0.0.1-8080-1) Cannot resolve com.mysq.jdbc.Connection.ping method. Will use 'SELECT 1' instead.: java.lang.ClassNotFoundException: com.mysql.jdbc.Connection from [Module "org.jboss.ironjacamar.jdbcadapters:main" from local module loader @105e55ab (roots: /Users/chris/.rvm/gems/jruby-1.6.5@jrails/gems/torquebox-server-2.0.0.beta2-java/jboss/modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120
@testflyjets
testflyjets / test_spreadsheet.rb
Created June 7, 2011 14:47
ruby spreadsheet example
require 'spreadsheet'
Spreadsheet.client_encoding = 'UTF-8'
TEST_FILE = "/Users/chris/test.xls"
MODIFIED_FILE = "/Users/chris/test_2.xls"
def inspect_sheet sheet
sheet.each do |row|
if row[1].is_a? Spreadsheet::Formula