Skip to content

Instantly share code, notes, and snippets.

View alexdiliberto's full-sized avatar

Alex DiLiberto alexdiliberto

View GitHub Profile
@alexdiliberto
alexdiliberto / ember.computed.flattenArray.js
Last active May 11, 2018 10:39
Ember.computed.flattenArray()
// ember-runtime/lib/computed/reduce_computed_macros.js
// Credit to Nopik via https://github.com/emberjs/ember.js/pull/3503
/*
var item1 = Ember.Object.create({
tags: [ 'important', 'bug', 'task' ],
});
var item2 = Ember.Object.create({
@alexdiliberto
alexdiliberto / gulpfile_template.js
Created January 31, 2014 05:52
Alex's gulpfile.js template
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
@alexdiliberto
alexdiliberto / ember_hooks.md
Last active August 29, 2015 13:56
Ember Hooks

Ember Hooks:

didTransition Fire on route change /ABC -> /XYZ and model change /ABC/1 -> /ABC/2

Ember.Router.reopen({
  didTransition: function() {
    this._super();
    //do stuff       
 }
@alexdiliberto
alexdiliberto / ember_longpolling.js
Last active August 29, 2015 13:57
Ember Longpolling
/**
Ember Longpolling
Periodically poll to update posts with latest comments
*/
//Create Pollster Object
App.Pollster = Ember.Object.extend({
start: function() {
this.timer = setInterval(this.onPoll.bind(this), POLL_INTERVAL);
},
@alexdiliberto
alexdiliberto / eak_testing_components.js
Created March 6, 2014 04:32
EAK - Testing Components
moduleForComponent('my-component', 'description', {
setup: function() { ... },
teardown: function() { ... }
});
@alexdiliberto
alexdiliberto / ember-view-domchanged.css
Created April 2, 2014 04:24
Quick little animation keyframe for domChanged events on Ember views
@keyframes domChanged { from { background: yellow; } }
@-webkit-keyframes domChanged { from { background: yellow; } }
.ember-view { animation: domChanged 1s; -webkit-animation: domChanged 1s; }
@alexdiliberto
alexdiliberto / ember-list-all-routes.js
Last active April 21, 2023 08:59
List all Ember route paths. (Just paste this in the console of your favorite Ember app)
// NOTE: `AppName` is simply your PascalCase application name (`modulePrefix` key from `../config/environment.js`)
window.AppName.__container__.lookup('service:router')._router._routerMicrolib.recognizer.names;

Keybase proof

I hereby claim:

  • I am alexdiliberto on github.
  • I am alexdiliberto (https://keybase.io/alexdiliberto) on keybase.
  • I have a public key whose fingerprint is 894B 0D4F 812A E8BA 5CBD BBF4 EF60 B9F3 A3CA E29E

To claim this, I am signing this object:

@alexdiliberto
alexdiliberto / REST-JSON-API.md
Created April 21, 2014 03:58
REST+JSON API Key Points
@alexdiliberto
alexdiliberto / curry.js
Created May 4, 2014 15:48
Curry functions in Javascript with variable argument lengths
function toArray(args) {
return [].slice.call(args);
}
function sub_curry(fn /*, variable number of args */) {
var args = [].slice.call(arguments, 1);
return function () {
return fn.apply(this, args.concat(toArray(arguments)));
};
}