Skip to content

Instantly share code, notes, and snippets.

View booty's full-sized avatar

John Booty booty

  • Upstart
  • Near Philadelphia, PA
  • 06:18 (UTC -04:00)
View GitHub Profile
@booty
booty / KeenCallbacks
Last active December 15, 2015 05:19
The success/failure callbacks in Keen.addEvent don't seem to work in Internet Explorer 9. This code works in the latest versions of FF, Chrome, Safari, and Opera. In IE9, the call to Keen.addEvent succeeds (and I can view it on my project page at http://Keen.io! but the functions inside the callbacks (the window.location.href calls) are never ex…
/*
Set a jQuery event handler; we want to record outgoing clicks with Keen.io
*/
$('a').click(function (e) {
e.preventDefault(); // otherwise, we'll navigate to new page before Keen object fires tracking event back to server
var linkName = e.currentTarget.title || e.currentTarget.href; // fall back to href if no title
Keen.addEvent("Link Clicked", {
LinkName: linkName,
CalendarCode: $.cookie('refCode')
@booty
booty / gist:5f7d3e4264fcc535715f
Last active August 29, 2015 14:13
Ruby: Better Message Security Through Floating-Point Hash Keys
x = { 'foo' => 'Normal Message', (0.1 + 0.02) => 'Secret Message' }
# Outputs 'Normal Message'
puts x['foo']
# Outputs NOTHING because 0.1 + 0.02 equals 0.12000000000000001, not 0.12!
# (The Russians wil never find the secret message!)
puts x[0.12]
@booty
booty / gist:39cef3e602ccd860d018
Created December 15, 2015 20:18
ConnectRooms#show JSON
{
"id": 928,
"name": "RETAIL LEADERSHIP",
"jid": "retail_leadership@conference.powerhrg.com",
"is_private": true,
"can_send": true,
"user_count": 36,
"created_by": "Mike Balush",
"created_by_id": 47,
"updated_by": "Mike Balush",
2.2.4 ~/Projects/pws (feature/api-v2) $ vagrant provision
==> nitro: Running provisioner: puppet_server...
==> nitro: Running Puppet agent...
==> nitro: stdin: is not a tty
==> nitro: Info: Caching certificate for iscandar.local.nitro.devbox
==> nitro: Info: Caching certificate_revocation_list for ca
==> nitro: Info: Caching certificate for iscandar.local.nitro.devbox
==> nitro: Info: Using configured environment 'production'
==> nitro: Info: Retrieving pluginfacts
==> nitro: Info: Retrieving plugin
2.2.4 ~/Projects/pws (feature/api-v2) $ vagrant provision
==> nitro: Running provisioner: puppet_server...
==> nitro: Running Puppet agent...
==> nitro: stdin: is not a tty
==> nitro: Info: Caching certificate for iscandar.local.nitro.devbox
==> nitro: Info: Caching certificate_revocation_list for ca
==> nitro: Info: Caching certificate for iscandar.local.nitro.devbox
==> nitro: Info: Using configured environment 'production'
==> nitro: Info: Retrieving pluginfacts
==> nitro: Info: Retrieving plugin
@booty
booty / yourmom.rb
Created October 25, 2016 16:18
I ran this under 2.3 and was confused.
# frozen_string_literal: true
class YourMom
def speak
msg = "You'll be late for school! It's #{Time.now}"
puts msg
puts "...object id was #{msg.object_id}"
msg2 = "Eat your vegetables!"
puts msg2
~/Projects/nitro-web $ ./install.sh   feature/call-recordings-better-s3  732  1  68   ✓
>>> Installing Component dependencies:
* components/apple_gsx_client
* components/connect-web-ui
yarn install v0.23.4
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 1.27s.
* components/connect_client
* components/desktop_connect
@booty
booty / jeremy.sql
Created May 24, 2017 00:37
Probably stating the obvious
select
ca1.source_id,
count(ca2.id) as 'total dupes',
/* begin stuff you will replace with yucky dynamic SQL */
sum(case ca2.source_id when 7785 then 1 else 0 end) as 'dupes_with_7785',
sum(case ca2.source_id when 7795 then 1 else 0 end) as 'dupes_with_7795',
sum(case ca2.source_id when 7805 then 1 else 0 end) as 'dupes_with_7805'
/* etc */
/* etc */
/* etc */
What Went Well
==============
- Learned a lot
- Garett enjoyed working with devops
- Excited to start more Utu work
- Kept plenty busy despite Utu not ramping up
- Pairing in person (John/Garett) was cool
- Deploy times continue to fall (QA deploys)
- Productive week (good point total)
cd .. && rm -rf nitro-web && git@github.com:powerhome/nitro-web.git