This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
window.hash = { | |
add: function(p) { | |
if (-1 == window.location.hash.indexOf(p)) | |
window.location.hash += p + ','; | |
}, | |
remove: function(p) { | |
window.location.hash = window.location.hash.replace(p + ',', ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rivets.binders['on-valid'] = { | |
'function': true, | |
unbind: function(el) { | |
$(el).data('validator', null) | |
.unbind('validate'); | |
}, | |
routine: function(el, value) { | |
var handler = this.handler = this.eventHandler(value); | |
return $(el) | |
.on('submit', function() { return false; }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dust.helpers.mon = function(chunk, ctx, bodies, params) { | |
return chunk.map(function(chunk) { | |
var m = params.name; | |
if (!m || !models[m]) return chunk.write('No such model').end(); | |
models[m].findOne().exec(function(err, doc) { | |
if (err) return chunk.write(err).end(); | |
chunk.render(bodies.block, ctx.push(doc)).end(); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on http://codepen.io/zitrusfrisch/pen/bJwhk | |
function easyParallax() { | |
var scrollPos = w.scrollTop(); | |
$('#banner').css({ | |
'background-position' : '50% ' + (-scrollPos/4)+"px" | |
}); | |
$('#bannertext').css({ | |
'margin-top': (scrollPos/4)+"px", | |
'opacity': 1-(scrollPos/250) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() { var i = 0; function nextImg() { var imgs = document.querySelectorAll('img'), el; while (i < imgs.length) { el = imgs[i]; i++; if (el.getBoundingClientRect().top > 0) { return el.scrollIntoView(); } } i = 0; } document.addEventListener('keypress', function(e) { var key = String.fromCharCode(e.keyCode || e.which); if (key == 'j') nextImg(); }); nextImg(); })(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alignment = left center right justify start end | |
text() | |
sized = false | |
for arg in arguments | |
if arg is a 'color' | |
color arg | |
else if arg is a 'unit' | |
if sized | |
line-height arg | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateArray (arr, newArr) { | |
if (!arr.index) | |
arr.index = arr.reduce(function(seed, item) { | |
seed[item.id] = item | |
return seed | |
}, {}) | |
newArr.forEach(function(item) { | |
if (arr.index[item.id]) | |
return _.assign(arr.index[item.id], item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = express() | |
// browser sync | |
if (app.get('env') === 'development') { | |
var bs = require('browser-sync')({ | |
logSnippet: false, | |
files: ['pub/*.html', 'pub/css/*.css', 'views'] | |
}) | |
app.use(require('connect-browser-sync')(bs)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"dev": "webpack-dev-server --inline --hot" | |
} | |
} |