Skip to content

Instantly share code, notes, and snippets.

@benhodgson87
benhodgson87 / decimalFormat.js
Last active November 8, 2020 18:11
DecimalFormat Currency Formatting
Number.prototype.currency = function (format) {
var amt = this, neg;
// If no formatting string supplied
// or amount is not a number, return as is
if (!format || isNaN(amt)) return amt;
// Extract placeholders from format string
var formFig = format.match(/\#(.*)\#/g).pop();
@benhodgson87
benhodgson87 / Crowdsurge .gitignore
Last active December 31, 2015 17:38
.gitignore Boilerplate for Crowdsurge Repos
# .gitignore Boilerplate
#
# For noise that might accidentally end up in Repos
# And anything that should be in S3
# -------------------------------------------------
# Noise
# -----
@benhodgson87
benhodgson87 / dateformat.html
Last active December 31, 2015 00:39
Date formatting function for Example ballot
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div id="date"></div>
</body>
@benhodgson87
benhodgson87 / rgba-fallback.scss
Last active December 29, 2015 17:29
Sass RGBA Fallback Mixin
/**
* RGBA & Hex Fallback
*
* Takes a hex code with comma separated alpha value.
* Falls back to just the hex if no alpha is provided.
*
* Params:
* $prop: The CSS property to apply the color value to
* $color: A hex code, or bracketed Hex + Opacity figure. eg: (#fff, 0.5)
*