Skip to content

Instantly share code, notes, and snippets.

View russellkt's full-sized avatar

Kevin Russell russellkt

View GitHub Profile
var _ = Underscore.load();
function getCountyFactors(county) {
var allCountyFactors = getTableByName('CountyFactors','Index');
var countyFactors = allCountyFactors.select({"County":county.toUpperCase()});
var countyFactorsMap = {};
_.each(countyFactors, function(countyFactor){
countyFactorsMap[countyFactor.getFieldValue('Peril')] = countyFactor.getFieldValue('Factor');
});
return countyFactorsMap;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@russellkt
russellkt / fireDepartmentGAS.js
Created December 3, 2015 14:24
FireDepartmentGAS
function doGet(request) {
var encodedAddress = request.parameters.address;
var address = decodeURIComponent(encodedAddress);
var location = geocode(address);
var fusionStations = queryFusionForStations(location).rows;
var fireStations = createFireStationsFrom(fusionStations);
var stations = distanceMatrix(location,fireStations);
var response = {'address':address,'stations':stations};
return ContentService.createTextOutput(JSON.stringify(stations))
.setMimeType(ContentService.MimeType.JSON);
require 'lib/cleared_check'
require 'lib/cleared_check_updater'
require 'rubygems'
require 'fastercsv'
require 'sinatra'
require 'json'
require 'haml'
@@cleared_checks = ClearedCheckUpdater.read
require 'lib/cleared_check'
require 'rubygems'
require 'fastercsv'
require 'sinatra'
require 'json'
@@cleared_checks = []
FasterCSV.foreach('data/cleared_checks.csv', :headers => true) do |line|
@@cleared_checks << ClearedCheck.new(line)
import au.com.bytecode.opencsv.*
def xmlFilePattern = ~/.*\.XML/
def iterator = 0
def itemAttributes, contentAttributes
String[] checkAttributes
def checks = []
new File('/Volumes/mac3/cleared_checks/').eachFileMatch(xmlFilePattern){
def xmlFile = new XmlParser().parse(it)
writer = new CSVWriter(new FileWriter("/Volumes/mac3/cleared_checks.csv"))
writer.writeNext(checkAttributes)
checks.each{ writer.writeNext(it)}
writer.close()
def xmlFilePattern = ~/.*\.XML/
def iterator = 0
def itemAttributes, contentAttributes
def checkAttributes = []
def checks = []
new File('/Volumes/mac3/cleared_checks/').eachFileMatch(xmlFilePattern){
def xmlFile = new XmlParser().parse(it)
def items = xmlFile.Item
if(itemAttributes == null){
def self.policies_with_balance start_date, end_date
cond = []
cond << "(policies.delete_code is null OR policies.delete_code = '')"
cond << "expires_on BETWEEN ? AND ?"
cond << "total_premium - payment_amount > 0.00"
find( :all,
:conditions => [ cond.join(" AND "), start_date, end_date ],
:order => 'policies.policy_number ASC' )
end
1) Error:
test_ruby_jasper_can_compile_report(RubyJasperTest):
NameError: uninitialized constant RubyJasper::JRXmlLoader
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:102:in `const_missing'
/Users/ktrussell/rails_projects/RailsApplication1/lib/ruby_jasper.rb:12:in `compile_report'
/Users/ktrussell/rails_projects/RailsApplication1/test/unit/ruby_jasper_test.rb:7:in `test_ruby_jasper_can_compile_report'
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:60:in `run_with_callbacks_and_testunit'
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'