Skip to content

Instantly share code, notes, and snippets.

importPackage(com.terminalfour.publish.utils);
var UTILS = eval(String(com.terminalfour.publish.utils.BrokerUtils.processT4Tags(dbStatement, publishCache, section, null, language, isPreview, '<t4 type="media" id="410587" formatter="inline/*" />')));
try {
var layout = "text/default";
var isResponsive = UTILS.isResponsivePage();
if (isResponsive === true) {
layout = "text/responsive";
}
@chris5marsh
chris5marsh / SassMeister-input.scss
Created June 24, 2015 14:31
Generated by SassMeister.com.
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
$c-btn: (
default: blue,
primary: red
);
@chris5marsh
chris5marsh / banish_ds_store
Created February 17, 2015 14:35
Add a global .gitignore with .DS_Store on
# specify a global exclusion list
git config --global core.excludesfile ~/.gitignore
# adding .DS_Store to that list
echo .DS_Store >> ~/.gitignore
thousandSeparator = function (numString) {
return numString.replace(/\B(?=(\d{3})+(?!\d))/g, ",")
}
@chris5marsh
chris5marsh / no-overscroll.js
Created October 20, 2014 12:40
Stop overscrolling on iOS devices
// Stop overscrolling
document.ontouchmove = function(event){
event.preventDefault();
}
@chris5marsh
chris5marsh / PromiseChain.js
Created February 19, 2014 11:37
Run a function on each member of an array (like reduce) but use promises to chain them together asynchronusly
/**
* Makes chain of promises
* @param {function} toRun Function to apply to each item
* @param {array} processArray Array of items to process
* @return {promise} Final promise to pass on
*/
chain: function(toRun, processArray) {
var defer = Q.defer();
var args = Array.prototype.slice.call(arguments).slice(2);
processArray.reduce(function (previous, current) {
@chris5marsh
chris5marsh / autofill.js
Created January 16, 2014 13:51
Quick script to autofill a simple form.
$(function() {
// autofill();
$('.autofill').click(function(e) {
e.preventDefault();
autofill();
});
});
@chris5marsh
chris5marsh / isBetween.js
Created October 31, 2013 11:41
Find out if a number is between two others
// Find out if number is between a and b
if (typeof(Number.prototype.isBetween) === "undefined") {
Number.prototype.isBetween = function(a, b) {
var max = Math.max(a,b),
min = Math.min(a,b);
return (this <= max) && (this >= min);
};
}
@chris5marsh
chris5marsh / LICENSE.txt
Created February 9, 2012 14:49 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE