Skip to content

Instantly share code, notes, and snippets.

$('input[type="date"]').each(function()
{
var picker = new Pikaday({ field: this });
$(this).data('pikaday', picker);
});
@dbushell
dbushell / gist:5186122
Last active December 15, 2015 02:19
Grunt task to build HTML templates with includes (work in progress!)
/*!
*
* Copyright (c) David Bushell | @dbushell | http://dbushell.com/
*
*/
var fs = require("fs"),
path = require("path");
module.exports = function(grunt)
@dbushell
dbushell / htmlizr.js
Last active December 15, 2015 20:19
Grunt task to build HTML templates with includes (original version: https://gist.github.com/dbushell/5186122)
/*!
*
* Copyright (c) David Bushell | @dbushell | http://dbushell.com/
*
*/
var fs = require("fs"),
path = require("path");
module.exports = function(grunt)
// http://jasonwyatt.tumblr.com/post/10481498815/how-to-correctly-debounce-a-javascript-function
function debounce(fn, debounceDuration)
{
debounceDuration = debounceDuration || 100;
return function(){
if(!fn.debouncing){
var args = Array.prototype.slice.apply(arguments);
fn.lastReturnVal = fn.apply(window, args);
fn.debouncing = true;
@dbushell
dbushell / rpi-gpio-epaper-full-picture.js
Created October 2, 2017 07:45
rpi-gpio-epaper full picture example
const fs = require('fs');
const PNG = require('pngjs').PNG;
const EPD = require('rpi-gpio-epaper');
function readImage(imagePath) {
return new Promise((resolve, reject) => {
fs
.createReadStream(imagePath)
.pipe(new PNG())
.on('parsed', function() {
const fs = require('fs');
const path = require('path');
const PNG = require('pngjs').PNG;
const EPD = require('rpi-gpio-epaper');
function readImage(imagePath) {
return new Promise((resolve, reject) => {
fs
.createReadStream(imagePath)
.pipe(new PNG())