I hereby claim:
- I am justinwinslow on github.
- I am jwin (https://keybase.io/jwin) on keybase.
- I have a public key whose fingerprint is 465E 9D17 019E 4F5C DE28 6E15 AC1A DB8F BAE2 D3DC
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// Grab or create stored data | |
$scope.localData = JSON.parse(localStorage.getItem('localData')) || {}; | |
// Watch for items to change and update data in localStorage | |
$scope.$watch('localData', function(localData, oldLocalData){ | |
if (localData != oldLocalData) { | |
localStorage.setItem('localData', JSON.stringify($scope.localData)); | |
} | |
}, true); |
angular.module('someModule', []) | |
.directive('ngRepeatTimer', function() { | |
var start; | |
return function(scope) { | |
if (scope.$first) { | |
start = new Date().getTime(); | |
} | |
if (scope.$last){ | |
console.log('ng-repeat rendering time:', new Date().getTime() - start); | |
} |
$provide.decorator('$http', ['$delegate', function($delegate) { | |
// Angular injects the service as $delegate | |
var $http = $delegate; | |
// Store promises for requests | |
var pendingRequests = []; | |
// Let's overwrite the get method to prevent duplicate queries | |
$http.get = function (url, config) { | |
config = config || {}; | |
// Let's make a simple key for us to reference on subsequent requests |
/* | |
DIRECTORY STRUCTURE | |
module1.js | |
module2.js | |
module2/ | |
- model.js | |
- view1.js | |
- view2.js |
//New constructor | |
var cons = function(){ | |
var property_private = 'bye'; | |
this.property_public = 'see ya'; | |
//Instead of returning this, return only what needs | |
//to be accessible | |
return { | |
property_public: this.property_public, | |
method_public: function(){ |
Timeseries format | |
{ | |
device_legend: [device1, device2], | |
data_legend: [[dataType1, dataType2], [device2_dataType1]], | |
data: [ | |
{ | |
x: timestamp, | |
y: [ | |
[ |
//Log events fired on given DOM element | |
monitorEvents(elem); | |
unmonitorEvents(elem); | |
//See a trace of how we reached this line. | |
console.trace(); | |
//Performance timing | |
console.time('Timer'); | |
console.timeEnd('Timer'); |
# Add multiple servers at different ports for load balancing | |
upstream node { | |
server 127.0.0.1:3005; | |
} | |
# the nginx server instance | |
server { | |
listen 0.0.0.0:80; | |
server_name {{ your_app_name }} {{ your.domain.com }}; | |
access_log /var/log/nginx/{{ your.domain.com }}.log; |
define([ | |
'jquery', | |
'underscore', | |
'backbone', | |
'backbone.marionette', | |
'backbone.virtual-collection', | |
'hbs!navigation/templates/list', | |
'hbs!navigation/templates/listItem' | |
], function( |