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 / .vimrc
Last active December 23, 2015 13:48
VimL ( Vim Language ) key maps.
" map :w to r to save and run tets
map r :w<CR>
" map wq to :wq
map wq :wq<CR>
" map Caps (bye bye) to quit from insert mode
imap <Caps> <Esc><CR>
" map watchr to run tests, looks for

its isn't core to RSpec. One the of the focuses of RSpec is on the documentation aspects of tests. Unfortunately, its often leads to documentation output that is essentially lies. Consider this spec:

User = Struct.new(:name, :email)

describe User do
  subject { User.new("bob") }
  its(:name) { should == "bob" }
end
@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" ],