Skip to content

Instantly share code, notes, and snippets.

@jstrimpel
jstrimpel / gist:bbd78f80f44ab195058f
Last active August 29, 2015 14:18
d3 widget after render
var root = this.attributes.model.toJSON();
var diameter = 960;
var format = d3.format(',d');
var color = d3.scale.category20c();
var bubble = d3.layout.pack()
.sort(null)
.size([diameter, diameter])
.padding(1.5);
var svg = d3.select(this.el).append('svg')
.attr('width', diameter)
@jstrimpel
jstrimpel / gist:599a516a5209844c967e
Last active August 29, 2015 14:17
NPM: Package Management for Isomorphic Web Applications

NPM is the defacto package manager for CommonJS style modules leveraged by a Node application on the server. However, a set of best practices has recently emerged advocating the use of NPM to manage client packages over other client package managers such as Bower. Client packages are essentially packaged the in the same fashion as server packages, but package metadata and lifecycle scripts are used when necessary to facilitate the creation of artifacts that are consumed by the client. This concept is now being extended to isomorphic JavaScript applications. This talk will explore a real world use case focused on these best practices at WalmartLabs that is being used to package and build isomorphic web applications. The talk will cover the metadata schema and OSS build tools that are used to create various types of artifacts from node module packages. A demo will showcase the automated construction of an applica

@jstrimpel
jstrimpel / gist:061f4f26aa9e2314673b
Created February 19, 2015 21:37
load locale data for globalize in model syncher
define(['lazoSyncher'], function (LazoSyncher) {
'use strict';
return LazoSyncher.extend({
fetch: function (options) {
var path = 'json!' + options.params.resource + '/' + options.params.locale + '.json'
LAZO.require([path], function (json) {
options.success(json);
@jstrimpel
jstrimpel / gist:b0437d1c2fbc436dd310
Last active August 29, 2015 14:15
load data for view serialization
define(['lazoView'], function (LazoView) {
'use strict';
return LazoView.extend({
serializeData: function (options) {
var self = this;
someAsnycFunc(function (err, localized) {
if (err) {
@jstrimpel
jstrimpel / gist:71f807ad37fe7fa9b999
Last active August 29, 2015 14:14
lazo package.json meta data schema
// repo is a model
{
"lazo": {
"model": true
}
}
// repo is component with a dist
{
"lazo": {
@jstrimpel
jstrimpel / server.js
Created November 18, 2014 23:39
server debugging
// https://github.com/walmartlabs/lazojs/wiki/Server-Setup
// app/server/server.js
define(['lazoServer'], function (LazoServer) {
'use strict';
return LazoServer.extend({
setup: function (hapi, pack, servers, options) {
for (var k in servers) {
@jstrimpel
jstrimpel / app.js
Last active August 29, 2015 14:09
lazo application filters example
define(['lazoApp', 'app/filters/auth'], function (LazoApp, authFilter) {
'use strict';
return LazoApp.extend({
initialize: function (callback) {
LAZO.app.addRequestFilter('.*', authFilter);
callback();
}
@jstrimpel
jstrimpel / base.js
Last active August 29, 2015 14:09
mongodb collection syncher example
// app/server/synchers/base.js
define(['lazoSyncher'], function (LazoSyncher) {
'use strict';
// set up mongo connection here; not sure of best practices for establishing connections
// https://www.npmjs.org/package/mongodb
return LazoSyncer.extend({
@jstrimpel
jstrimpel / directory structure
Last active August 29, 2015 14:09
web components
|- application
|- imports
hp.html (base element; includes polymer)
avatar.html
share.html
|- components
|- profile
|- imports
index.html
@jstrimpel
jstrimpel / view
Created November 11, 2014 19:16
deprecated widget def
define(['lazoView'], function (View) {
'use strict';
return View.extend({
widgets: {
Avatar: 'app/widget-defs/avatar'
},