Skip to content

Instantly share code, notes, and snippets.

@danro
danro / index.js
Created Jun 28, 2014
requirebin sketch
View index.js
var mash = require('mash-js');
var withSword = mash(function () {
this.slash = function (dmg) {
console.log('Sword slash for ' + dmg + ' damage!');
};
});
var withMagic = mash(function () {
this.fireball = function (dmg) {
@danro
danro / index.js
Created Jun 28, 2014
requirebin sketch
View index.js
var mash = require('mash-js');
function Animal() {}
mash(Animal, function() {
this.init = function(name) {
this.name = name;
};
this.move = function(meters) {
console.log(this.name + ' moved ' + meters + 'm.');
@danro
danro / index.js
Created Jun 28, 2014
requirebin sketch
View index.js
var mash = require('mash-js');
var foo = mash(function () {
this.init = function () {
console.log('hello mash');
};
});
foo.create();
@danro
danro / readme.md
Last active Aug 29, 2015
mash.js - functional prototype mixins
@danro
danro / embed.html
Last active Jan 2, 2016
video tag example
View embed.html
<video autoplay loop style="width:100%; height: auto; position:absolute; z-index: -1;">
<source src="http://syddev.com/jquery.videoBG/assets/tunnel_animation.mp4" type="video/mp4" />
<source src="http://syddev.com/jquery.videoBG/assets/tunnel_animation.ogv" type="application/ogg" />
<img src="http://syddev.com/jquery.videoBG/assets/tunnel_animation.jpg">
</video>
@danro
danro / throttle-frame.js
Last active Jun 21, 2016
underscore throttle using requestAnimationFrame
View throttle-frame.js
// Returns a function, that, when invoked, will only be triggered once every
// browser animation frame - using tram's requestAnimationFrame polyfill.
// tram.js - https://github.com/bkwld/tram
_.throttle = function(func) {
var wait, args, context;
return function () {
if (wait) return;
wait = true;
args = arguments;
context = this;
@danro
danro / placeholder.css
Last active Dec 29, 2015
html5 placeholder text
View placeholder.css
::-webkit-input-placeholder { /* WebKit browsers */
color: #bada55 !important;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #bada55 !important;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #bada55 !important;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
@danro
danro / webflow-resize.js
Created Nov 12, 2013
Webflow.js resize example
View webflow-resize.js
var Webflow = Webflow || [];
Webflow.push(function () {
// Find example element
var $element = $('.resize-demo');
var $parent = $element.parent();
// Listen for optimized resize event
Webflow.resize.on(function () {
@danro
danro / webflow-mixitup.js
Created Nov 12, 2013
Webflow wrapper for jQuery.mixitup
View webflow-mixitup.js
var Webflow = Webflow || [];
Webflow.push(function () {
/*
* MIXITUP - A CSS3 and JQuery Filter & Sort Plugin
* Version: 1.5.4
* License: Creative Commons Attribution-NoDerivs 3.0 Unported - CC BY-ND 3.0
* http://creativecommons.org/licenses/by-nd/3.0/
* This software may be used freely on commercial and non-commercial projects with attribution to the author/copyright holder.
* Author: Patrick Kunka
@danro
danro / webflow-snippet.js
Last active Feb 17, 2021
Webflow.js front-end JS wrapper
View webflow-snippet.js
var Webflow = Webflow || [];
Webflow.push(function () {
// DOMready has fired
// May now use jQuery and Webflow api
});