Skip to content

Instantly share code, notes, and snippets.

View kevindavis's full-sized avatar

Kevin Davis kevindavis

View GitHub Profile
"id": 2682,
"resolved_at": null,
"status": "dispatched",
"room_id": 100,
"call_type_id": 17,
"organization_id": 3,
"created_at": "2022-05-01T23:31:27.517Z",
"updated_at": "2022-05-01T23:49:04.140Z",
"updated_from": null,
"id": 100,
"name": "420",
"organization_id": 3,
"created_at": "2022-01-21T01:03:59.686Z",
"updated_at": "2022-01-21T01:11:48.494Z",
"connected_device": true,
"device": {
"id": 825,
"organization_id": 3,
kevindavis / sales.sql
Created December 18, 2015 00:19
query splitting out joule / premium sales
SUM(joule_sale) as joule_sales,
SUM(premium_sale) as premium_sales,
CASE WHEN amount > 15000 THEN 1 ELSE NULL END as joule_sale,
CASE WHEN amount < 15000 THEN 1 ELSE NULL END as premium_sale,
date_trunc('day', occurred_at - interval '8 hours') as date
kevindavis / stripe_sales.rb
Created December 18, 2015 00:15
Geckoboard Stripe Integration
#!/usr/bin/env ruby
require 'stripe'
require 'byebug'
require 'json'
task :import_stripe_sales do
Stripe.api_key = ENV['STRIPE_SECRET_KEY']
latest = @db.exec("SELECT details->>'id' as id FROM stripe_charges ORDER BY occurred_at DESC LIMIT 1").first
kevindavis / gist:2dbbfb70dd8becf557ef
Last active August 29, 2015 14:23
fixup for youtube ids
youtube_id = '/L7dvr5_At1Y' OR
youtube_id = '/wrALejpF-sY' OR
youtube_id = '/pheweKtzMNI' OR
youtube_id = '/uMQ8iJ4VIGk' OR
require 'parse-ruby-client'
require 'date'
Parse.init application_id: ENV['PARSE_APP_ID'],
api_key: ENV['PARSE_API_KEY'],
master_key: ENV['PARSE_MASTER_KEY'],
quiet: true
def get_class(classname)
get_class_in_range(classname, Date.parse('2014-01-01'), + 1)
kevindavis / gist:131c6c4cd849c9669814
Created January 24, 2015 00:08
Results from a Mode report
def results_for_report(report_token)
report = HTTParty.get(''+report_token+'?embed%5Breport_runs%5D=1', @auth)
last_run_token = report['_embedded']['report_runs']['_embedded']['report_runs'][0]['token']
results_url = HTTParty.get(''+report_token+'/runs/'+last_run_token+'/results', @auth)['_links']['json']['href']
Our website is hosted on Heroku, which we deploy via git when we have new changes to make
It's SEO-preferable to have your sitemap.xml on the same domain/subdomain as the content being served. Might be SEO-impossible to do otherwise.
We want sitemap.xml to be decently up to date
We don't want sitemap.xml to be overwritten when we deploy a new version of the app
Solutions considered
1. (current) Kevin runs a script whenever he remembers that generates sitemap.xml, checks it in and pushes it
- Kevin is unreliable and his time is somewhat valuable.. sometimes
kevindavis / scraper.rb
Created October 23, 2013 20:13
grabs emoji codes and filenames out of the page and dumps them into a string designed to be pasted into the Yammer emoticon processing stuff
#!/usr/bin/env ruby
# USAGE: ./scraper.rb | pbcopy
# need to check out emoji-cheat-sheet from github
# ==>
filename = ARGV[0]
file =, "r")
kevindavis / gist:1868669
Created February 20, 2012 10:15
Bootstrap styling for jQuery UI date picker
background-image: none;
background-color: #0088cc; color: #fff;
.ui-datepicker-prev span.ui-icon
background-image: url("/assets/glyphicons-halflings-white.png");