Skip to content

Instantly share code, notes, and snippets.

View jaridmargolin's full-sized avatar

Jarid Margolin jaridmargolin

View GitHub Profile
@jaridmargolin
jaridmargolin / conversion_async_loader.js
Created February 17, 2016 01:05
Async script loader for conversion_async.js
!function(e,n,t,a,o,c,r,s,i){e[o]||(r=e[o]=function(){r.track=arguments},
c=n.createElement(t),c.src=a,c.async=!0,c.addEventListener('load',function(){
r.track&&e[o].apply(this,r.track)}),s=n.getElementsByTagName(t)[0],s.parentNode.insertBefore(c,s))
}(window,document,'script','//www.googleadservices.com/pagead/conversion_async.js',
'google_trackConversion');
@jaridmargolin
jaridmargolin / utils-decorate.js
Created June 7, 2014 21:27
underscore.js decorator method
/*!
* utils.js
*
* Copyright (c) 2014
*/
define([
'underscore',
],function (_) {
@jaridmargolin
jaridmargolin / analytics.js
Created May 14, 2014 21:33
AMD google analytics compatible with almond.js
/*!
* analytics.js
*
* Copyright (c) 2014
*/
define([
'require',
'env'
], function (require, env) {
@jaridmargolin
jaridmargolin / tbl.less
Last active August 29, 2015 14:00
A column implementation using tables built to use with bootstrap.
/*!
* tbl.less
* Version: 1.0
*/
/*** TABLE OF CONTENTS ***
*
* 1. Mixins
* 2. tbl
*/
@jaridmargolin
jaridmargolin / utils-deep.js
Last active August 29, 2015 13:57
Utils - deep extend and deep merge.
define([
'underscore'
], function (_) {
// ----------------------------------------------------------------------------
// utils
// ----------------------------------------------------------------------------
var utils = {};
;(function (id, name, context, definition) {
// --------------------------------------------------------------------------
// Dependencies
//
// This is an attempt to make this library compatible with multiple module
// formats. Other UMD implementations do not take into account dependencies:
// Example: https://github.com/ForbesLindesay/umd/blob/master/template.js
//
// **NOTE: Named AMD modules are more suitable for libraries as it provides
@jaridmargolin
jaridmargolin / measure-width.js
Last active December 28, 2015 01:19
Get text length
//
// Get text width of a specified element.
//
function measureWidth(el, str) {
// Create dummy elem
var div = documtent.createElement('div');
// Append
document.body.appendChild(div);