Skip to content

Instantly share code, notes, and snippets.

View danro's full-sized avatar
👀

Dan Rogers danro

👀
View GitHub Profile
@danro
danro / index.js
Created June 28, 2014 20:01
requirebin sketch
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 June 28, 2014 19:29
requirebin sketch
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 June 28, 2014 19:22
requirebin sketch
var mash = require('mash-js');
var foo = mash(function () {
this.init = function () {
console.log('hello mash');
};
});
foo.create();
@danro
danro / readme.md
Last active August 29, 2015 14:03
mash.js - functional prototype mixins
@danro
danro / embed.html
Last active January 2, 2016 03:49
video tag example
<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 June 21, 2016 04:38
underscore throttle using requestAnimationFrame
// 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 December 29, 2015 03:29
html5 placeholder text
::-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 November 12, 2013 18:59
Webflow.js resize example
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 November 12, 2013 17:52
Webflow wrapper for jQuery.mixitup
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 August 17, 2022 19:29
Webflow.js front-end JS wrapper
var Webflow = Webflow || [];
Webflow.push(function () {
// DOMready has fired
// May now use jQuery and Webflow api
});