Skip to content

Instantly share code, notes, and snippets.

View acnalesso's full-sized avatar

Antonio C Nalesso Moreira acnalesso

View GitHub Profile
@acnalesso
acnalesso / 1_faraday.rb
Last active August 29, 2015 14:07 — forked from iain/1_faraday.rb
require 'logger'
$logger = Logger.new(STDOUT)
require 'active_support/cache'
$cache = ActiveSupport::Cache.lookup_store(:memory_store)
$cache.logger = $logger
$cache.clear
class EtagMiddleware
import Ember from "ember";
import { test, moduleForComponent } from "ember-qunit";
moduleForComponent("show-products");
test('should not show products for the first time', function() {
var component = this.subject();
equal(component.get('showingProducts'), false);
});
@acnalesso
acnalesso / ember-setup
Created December 1, 2014 17:54
What happens when you do Ember.run
backburner = new Backburner(
['syc', 'actions', 'destroy'],
{
GUID_KEY: GUID_KEY,
sync: {
before: beginPropertyChanges,
after: endPropertyChanges
},
defaultQueue: 'actions',
onBegin: onBegin,
@acnalesso
acnalesso / onBegin_onEnd
Created December 1, 2014 18:11
Ember's onBegin and onEnd callbacks.
function onBegin(current) {
run.currentRunLoop = current;
}
function onEnd(current, next) {
run.currentRunLoop = next;
}
@acnalesso
acnalesso / ember-run
Created December 1, 2014 18:19
Ember run method definition
export default run;
function run() {
return backburner.run.apply(backburner, arguments)
}
Ember.run(function() {
console.log('true');
});
@acnalesso
acnalesso / deferredActionQueues
Created December 1, 2014 18:36
Backburner's DeferredActionQueues object
function DeferredActionQueues(queueNames, options) {
var queues = this.queues = Object.create(null);
this.queueNames = queueNames || [];
this.options = options;
each(queueNames, function(queueName){
queues[queueName] = new Queue(queueName, options[queueName], options);
});
@acnalesso
acnalesso / return
Created December 1, 2014 18:47
DeferredActionQueues
DeferredActionQueues {queues: Object, queueNames: Array[3], options: Object}
// expanded
DeferredActionQueues {
queues: {
"actions": Queue,
"sync": Queue,
"destroy": Queue
},
queueNames: Array[ "actions", "sync", "destroy" ],
@acnalesso
acnalesso / queue
Created December 1, 2014 18:52
Backburner's Queue object
function Queue(name, options, globalOptions) {
this.name = name;
this.globalOptions = globalOptions;
this.options = options;
this._queue = [];
this.targetQueues = Object.create(null);
this._queueBeingFlushed = undefined;
}
@acnalesso
acnalesso / currentRunLoop
Created December 1, 2014 19:21
Ember.run.currentRunLoop
Ember.run.currentRunLoop
// undefined
Ember.run(function() {
console.log(Ember.run.currentRunLoop);
});
// DeferredActionQueues {queues: Object, queueNames: Array[6], options: Object, schedule: function, invoke: function…}
// You can run that in your browser and have a better look at it.