Skip to content

Instantly share code, notes, and snippets.

@rkgarg
rkgarg / post-repeat-directive.js
Last active June 28, 2017 11:41
Angular ng-repeat Benchmark
// Post repeat directive for logging the rendering time
angular.module('myApp').directive('postRepeatDirective',
['$timeout',
function($timeout) {
return function(scope) {
if (scope.$first)
window.a = new Date(); // window.a can be updated anywhere if to reset counter at some action if ng-repeat is not getting started from $first
if (scope.$last)
$timeout(function(){
console.log("## DOM rendering list took: " + (new Date() - window.a) + " ms");
@brenthargrave
brenthargrave / NSManagedObjectWithTimestamps.h
Created March 5, 2012 01:28 — forked from mikker/NSManagedObjectWithTimestamps.h
NSManagedObject with Rails-ish timestamps
//
// NSManagedObjectWithTimestamps.h
// Brainbow Apps, 2011
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface NSManagedObjectWithTimestamps : NSManagedObject
@cowboy
cowboy / ba-smallwalker.js
Created May 5, 2011 21:27
Small Walker: A small and simple JavaScript DOM walker
/*!
* Small Walker - v0.1.1 - 5/5/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// Walk the DOM, depth-first (HTML order). Inside the callback, `this` is the