Skip to content

Instantly share code, notes, and snippets.

function doThis(array, cb) {
var thisArray = array;
cb.apply( [{'original-array':thisArray}, {'new-array':thisArray.push(4,5,6)}] );
}
var doneIt = function doneIt() {
console.log(this);
}
doThis([1,2,3], doneIt);
var keystone = require('keystone');
exports = module.exports = function(req, res) {
var view = new keystone.View(req, res),
locals = res.locals;
// Set locals
locals.section = 'simplething';
var keystone = require('keystone');
/**
* SimpleThing Model
* ==========
*/
var SimpleThing = new keystone.List('SimpleThing', {
map: { name: 'title' },
autokey: { path: 'slug', from: 'title', unique: true },
var keystone = require('keystone');
exports = module.exports = function(req, res) {
var view = new keystone.View(req, res),
locals = res.locals;
// Set locals
locals.section = 'simplething';
// Import Route Controllers
var routes = {
views: importRoutes('./views')
};
// Setup Route Bindings
exports = module.exports = function(app) {
app.get('/simplething', routes.views.simplething);
@grantstandridge
grantstandridge / json_menus.html
Last active April 26, 2024 04:59
Select Menu Filter (from json obj)
<!--
DEMO FOR FILTERING JSON OBJECT & POPULATING DROPDOWN FIELDS.
===
jQuery not required for the parsing/filtering
jQuery only required for retrieving json object
===
by: Grant S
-->
<!DOCTYPE html>
var stickyHeader = function($anchor,$header){
var windowTop = $(window).scrollTop(),
anchorTop = $anchor.offset().top
;
// second condition is to ensure sticky nav only initiates on desktop
if ( (windowTop > anchorTop) && (window.outerWidth > 565) ) {
$header.addClass('stuck')
;
} else {
$header.removeClass('stuck')