Skip to content

Instantly share code, notes, and snippets.

@knation
knation / object_ids.go
Last active January 29, 2022 20:45
Example of object ID management in Golang (uses ksuid)
// Used to create, manage, and parse unique IDs. This code creates stripe-like IDs,
// (e.g., xx_000000000000000000000000000). It allows for a prefix and a 27
// character ksuid separated by an underscore. The prefix makes it easy
// to visibly identify what the ID is for.
//
// Author: Kirk Morales
package util
import (
@knation
knation / subscribe-popup.htm
Created November 10, 2015 19:47
Infusionsoft / Squarespace Subscribe Popup Form
<span id="custom-subscribe-button" class="sqs-system-button sqs-editable-button" style="float:right;">Subscribe</span>
<div id="custom-subscribe-popup-template" class="yui3-widget sqs-widget sqs-modal-lightbox" style="display:none;">
<div class="sqs-modal-lightbox-content">
<div class="lightbox-background"></div>
<div class="lightbox-inner">
<div class="lightbox-content" style="margin-top: 332.5px; margin-bottom: 332.5px;">
<div class="form-wrapper">
<div class="form-title">Subscribe</div>
<div class="form-inner-wrapper">
@knation
knation / subscribe.htm
Created November 10, 2015 19:43
Infusionsoft / Squarespace Subscribe Form
<div class="form-block sqs-block-form" data-block-type="9">
<div class="sqs-block-content">
<div class="form-wrapper">
<div class="form-inner-wrapper">
<form accept-charset="UTF-8" action="YOUR_VALUE" class="infusion-form" method="POST">
<input name="inf_form_xid" type="hidden" value="YOUR_VALUE" />
<input name="inf_form_name" type="hidden" value="YOUR_VALUE" />
<input name="infusionsoft_version" type="hidden" value="YOUR_VALUE" />
<div class="field-list clear">
@knation
knation / salesforceId.js
Created November 6, 2015 19:00
JavaScript Salesforce ID Check & Expansion
/**
* The regex for a SF ID.
* @type {RegExp}
* @const
*/
var ID_REGEX = /^[0-9a-zA-Z]{15}([0-9a-zA-Z]{3})?$/;
/**
* Array used to expand a SF ID from 15 to 18 characters.
* @type {Array.<String>}