Skip to content

Instantly share code, notes, and snippets.

Scott Watermasysk scottwater

Block or report user

Report or block scottwater

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View aes_helper_old_monkey_patch.rb
module Keen
class AESHelperOld
def self.aes256_encrypt(key, plaintext, iv = nil)
padded_key = key
aes =, :CBC)
aes.key = padded_key
aes.iv = iv unless iv.nil?
scottwater / push_bulk_in.rb
Created Mar 21, 2017
Sidekiq Push Bulk In
View push_bulk_in.rb
module Sidekiq
class Client
def self.push_bulk_in(interval, items)
int = interval.to_f
now =
ts = (int < 1_000_000_000 ? now + int : int)
items['at'.freeze] = ts if ts >= now
scottwater / leaderboard.htm
Last active Mar 14, 2017
More Leads on the LeaderBoard
View leaderboard.htm
<!- Add this to the header HTML area of your KickoffLabs Landing Page ->
var kol_leader_board_options = {board_settings: {limit: 25}};
scottwater / sample.html
Last active Jul 20, 2018
KickoffLabs Known Lead Event
View sample.html
$(document).ready(function() {
$(document).on('kol:knownlead', function(e, lead){
var social_id =;
scottwater / backplane_health_check.rb
Last active Jan 24, 2017
Sample health check middleware for
View backplane_health_check.rb
class BackplaneHealthCheck
OK_RESPONSE = [ 200, { 'Content-Type' => 'text/plain' }, ['OK!'.freeze]]
def initialize(app)
@app = app
def call(env)
if env['HTTP_HOST'.freeze] == 'backend'.freeze && env['PATH_INFO'.freeze] == '/health'.freeze
View weibo.html
var kol_share_links = {
network_overrides: [
[{network: 'weibo', share_text: "Hello Weibo!" language: 'zh_cn'}, 4]
scottwater / whatsapp.html
Created Apr 29, 2016
Add a what's app button to a KickoffLabs page or widget. Requires script versions 1.9.1 or greater.
View whatsapp.html
var kol_share_links = {
network_overrides: [
[{network: 'whatsapp', device_type: 'mobile', share_text: "Hello WhatsApp!"}, 4]
scottwater / leaderboard_incognito.html
Last active Feb 21, 2018
Customize your LeaderBoard name list
View leaderboard_incognito.html
<script type="template" id="incognito_rows">
scottwater / two_to_the_power.rb
Last active Apr 26, 2016
Validating a value is 2 to the power of something
View two_to_the_power.rb
valid_values = 1,2,4,8
invalid_values = 3,6,99,101
def is_two_to_the_power?(value)
(Math.log2(value) % 1.0) == 0
valid_values.each {|i| raise "#{i} is not valid" unless is_two_to_the_power?(i)}
invalid_values.each {|i| raise "#{i} is valid" if is_two_to_the_power?(i)}
scottwater / Widget Event
Created Jun 30, 2015
KickoffLabs Widget Success Event
View Widget Event
<script type="text/javascript">
$(document).bind("kol:success", function(e, data, status, xhr) {
You can’t perform that action at this time.