Skip to content

Instantly share code, notes, and snippets.

View acstll's full-sized avatar

Arturo Castillo Delgado acstll

View GitHub Profile
@acstll
acstll / scroll-to.js
Created January 13, 2016 18:38
animated scroll… (turn this into a library)
var raf = require('raf')
// https://gist.github.com/dezinezync/5487119
var easingFn = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t * t },
// decelerating to zero velocity
easeOutQuad: function (t) { return t * (2 - t) },
@acstll
acstll / index.js
Created December 3, 2015 21:24
requirebin sketch
var snabbdom = require('snabbdom')
var patch = snabbdom.init([ // Init patch function with choosen modules
require('snabbdom/modules/class'), // makes it easy to toggle classes
require('snabbdom/modules/props'), // for setting properties on DOM elements
require('snabbdom/modules/style'), // handles styling on elements with support for animations
require('snabbdom/modules/eventlisteners'), // attaches event listeners
])
var h = require('snabbdom/h') // helper function for creating VNodes
@acstll
acstll / merge.js
Created November 14, 2013 17:12
Simple options merger.
module.exports = defaults;
function defaults (target, source) {
target = target || {};
source = source || {};
var keys = Object.keys(source) || [];
if (!keys.length) return target;
if (Array.isArray(source)) {
@acstll
acstll / minstache-render.js
Created November 5, 2013 15:46
Minstache renderFile for express
'use strict';
var fs = require('fs');
var minstache = require('minstache');
var cache = Object.create(null);
exports.renderFile = function (path, options, callback) {
@acstll
acstll / tr-domify.js
Last active December 21, 2015 23:09
Browserify transform module for requiring html files through domify.
var through = require('through');
module.exports = function (file) {
if (!/\.html/.test(file)) return through();
var buffer = '';
return through(write, end);
@acstll
acstll / lodash-render.js
Last active May 28, 2016 07:09
Use lodash templates with Express 3
'use strict';
var fs = require('fs');
var _ = require('lodash');
var cache = Object.create(null);
exports.renderFile = function (path, options, callback) {
@acstll
acstll / coure.js
Created February 21, 2013 15:11
For (vanilla JS) learning purposes.
define(['underscore'], function() {
var root = window;
function Item (item) {
this.type = item.type;
this.source = item.source;
this.width = item.width;
this.height = item.height;
this.container = item.container; // A (left), B (right)