Skip to content

Instantly share code, notes, and snippets.

View scottwater's full-sized avatar

Scott Watermasysk scottwater

View GitHub Profile
@scottwater
scottwater / lb.html
Created November 4, 2019 14:39
Leaderboard Limit Override
<script>
window.kol_leader_board_options = {
board_settings: {
limit: 100
}
}
</script>
@scottwater
scottwater / pageData.js
Created October 17, 2019 23:43
See what data is available on a page in Eleventy
eleventyConfig.addNunjucksTag("pageData", function(nunjucksEngine) {
return new (function() {
this.tags = ["pageData"];
this.parse = function(parser, nodes, _) {
var tok = parser.nextToken();
var args = parser.parseSignature(null, true);
// fake it until you make it!
// https://github.com/mozilla/nunjucks/issues/158#issuecomment-34919343
@scottwater
scottwater / base_webhook.json
Last active October 3, 2020 04:11
KickoffLabs WebHooks
{
"__event": "the_webhook_event",
"avatar": "https://d1ts43dypk8bqh.cloudfront.net/v1/avatars/310c4ac2-7026-4700-afde-496b1d217b03",
"counter": 252,
"contest_score": 300,
"contest_score_rank": 19588,
"custom_fields": {
},
"email": "scott@kickofflabs.com",
@scottwater
scottwater / tailwind.config.js
Created September 13, 2019 17:06
Nord color palette in Tailwind
module.exports = {
theme: {
extend: {
colors: {
nord: {
"0": "#2E3440",
"1": "#3B4252",
"2": "#434C5E",
"3": "#4C566A",
"4": "#D8DEE9",
@scottwater
scottwater / lb.html
Last active June 12, 2019 15:28
Add this to the header of a KickoffLabs thank you page (until there is UI to make this setting)
<script>
window.kol_leader_board_options = {
board_settings: {
lead_description: 'full_name'
}
}
</script>
<script>
window.kol_leader_board_options = {
board_settings: {
lead_description: 'full_name'
}
}
</script>
@scottwater
scottwater / page.html
Created April 15, 2019 10:18
AnyForm Custom Callback
<script>
var kol_widget_options = {
callback: function(data) {
if (data.counter == 1) {
window.location = `https://YOURSITE.com?kid=${data.social_id}`;
} else {
window.location = data.redirect_url;
}
}
};
@scottwater
scottwater / index.js
Created March 27, 2019 14:04
Heroku/Fly SSL Proxy
import { proxy } from "@fly/cdn"
import { httpsUpgrader } from "@fly/cdn/lib/middleware"
const origin = proxy("https://YOURAPP.herokuapp.com", {
headers: { host: "YOURAPP.herokuapp.com" }
})
const router = httpsUpgrader(origin)
fly.http.respondWith(router)
@scottwater
scottwater / backplan_api.rb
Created February 23, 2018 18:46
Backplane API
class BackplaneApi
include HTTParty
debug_output $stderr if Rails.env.development?
base_uri 'www.backplane.io:443'
basic_auth ENV['BACKPLANE_TOKEN'], ''
format :json
def add_route(pattern, labels={})
@scottwater
scottwater / segment.html
Created February 22, 2018 14:09
Sample KickoffLabs Segment Integration.
<script type="text/javascript">
var segment_api_key = 'YOUR KEY HERE';
window.analytics||(window.analytics=[]),window.analytics.methods=["identify","track","trackLink","trackForm","trackClick","trackSubmit","page","pageview","ab","alias","ready","group","on","once","off"],window.analytics.factory=function(a){return function(){var t=Array.prototype.slice.call(arguments);return t.unshift(a),window.analytics.push(t),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var method=window.analytics.methods[i];window.analytics[method]=window.analytics.factory(method)}window.analytics.load=function(a){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=("https:"===document.location.protocol?"https://":"http://")+"d2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/"+a+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)},window.analytics.SNIPPET_VERSION="2.0.6",
window.analytics.load(segment_api_key),
window.analytics.page();
</scr