Skip to content

Instantly share code, notes, and snippets.

jQuery(document).ready(function($){
$.fancybox.open([
{
content : '<a id="ccfa_lander" href="http://ccteamchallenge.force.com/halfmarathon" target="_blank"><img src="<INSERT IMAGE URL HERE>" height="461" width="600"></a>'
}
], {
padding : 0
});
$('#ccfa_lander').click(function(event){
@sankage
sankage / images_as_checkboxes.coffee
Last active December 28, 2015 08:38
images as checkboxes
class ImagesAsCheckboxes
constructor: (question_id, conditions = null) ->
@conditions =
debug: conditions && conditions['debug'] || false
exclusive: conditions && conditions['exclusive'] || false
randomize: conditions && conditions['randomize'] || false
grid: conditions && conditions['grid'] || false
static_last: conditions && conditions['static_last'] || false
selector = "span[id^=#{question_id}C]"
@question_id = question_id
@sankage
sankage / countdown.coffee
Created December 10, 2013 21:21
a countdown clock
countdown = (eventdate, form) ->
cid = -1
start = ->
cid = setInterval update, 500
stop = ->
clearInterval cid
pad = (number, width = 2, z = '0') ->
number = "#{number}"
if number.length >= width
number
@sankage
sankage / dice.js
Last active July 9, 2018 02:17
D&D dice rollers
window.Dice || (window.Dice = {});
Dice.roll = function(dice) {
let match = /(\d+)?d(\d+)(?:\+(\d+))?/.exec(dice);
if (match == null) {
return {};
}
let number_of_dice = match[1] == undefined ? 1 : parseInt(match[1], 10);
let dice_size = parseInt(match[2], 10);
let modifier = match[3] == undefined ? 0 : parseInt(match[3], 10);