Skip to content

Instantly share code, notes, and snippets.

View mientjan's full-sized avatar
😀
Working

Mient-jan Stelling mientjan

😀
Working
View GitHub Profile
@mientjan
mientjan / gist:ce073078a195607f39a9
Created March 16, 2015 17:52
Handlebar: DumpHelper
function dump(context, options) {
function type(value){
var type = '';
if( Object.prototype.toString.call( value ) === '[object Array]' ){
type = 'array';
} else if(typeof value == 'object' ) {
type = 'object';
} else {
type = 'primitive';
@mientjan
mientjan / gist:d3bd1c3fd80a9112fb54
Created March 16, 2015 14:37
RegEx: find all script tags with cdata
var r = /\<script[\w\s\W]+?(\[CDATA\[)([\w\s\W]+?)(\]\]\>([\w\n]|)\<\/script\>)/
@mientjan
mientjan / gist:6061878
Created July 23, 2013 12:07
Make Chrome scroll smooth with large images that are moving
function makeChromeSmoothReplaceImage(img, maximumSize){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var newImg = new Image();
newImg.onload = function(){
var width = parseInt(this.width),
height = parseInt(this.height);