Skip to content

Instantly share code, notes, and snippets.

@efigarolam
efigarolam / keybase.md
Created January 24, 2017 22:02
keybase.md

Keybase proof

I hereby claim:

  • I am efigarolam on github.
  • I am efigarolam (https://keybase.io/efigarolam) on keybase.
  • I have a public key whose fingerprint is 1563 9986 24F0 108D 08A9 4C18 E457 A770 C8A6 FD7B

To claim this, I am signing this object:

@efigarolam
efigarolam / user_spec.rb
Created January 18, 2017 20:47
passing specs
describe '#managed_gift_card_systems' do
let!(:user) { create(:merchant_user) }
let!(:merchantless_gcs) { create(:gift_card_system) }
let!(:accountless_gcs) { create(:gift_card_system_with_merchant) }
before do
accountless_merchant = accountless_gcs.merchants.first
accountless_merchant.ledger_entity = nil
accountless_merchant.save(validate: false)
Capybara.default_wait_time = 20
Capybara.default_host = DEFAULT_HOST
Capybara.app = Capybara.app_host = DEFAULT_HOST
Capybara.configure do |config|
config.match = :prefer_exact
config.ignore_hidden_elements = false
end
Capybara.run_server = false
@efigarolam
efigarolam / new_post_controller.js
Created November 13, 2013 15:22
Ember Controller example for Testing Ember.js
App.NewPostController = Ember.ObjectController.extend({
needs: ['currentUser'],
currentUser: Ember.computed.alias('controllers.currentUser'),
errors: [],
validates: function() {
var author, content, title;
title = this.get('content.title');
content = this.get('content.content');
author = this.get('content.author');
@efigarolam
efigarolam / new_post_route.js
Created November 12, 2013 00:22
Ember Route example for Testing Ember.js
App.NewPostRoute = Ember.Route.extend({
model: function() {
return this.store.createRecord('post');
},
enter: function() {
if (!this.controllerFor('currentUser').get('isAdmin')) {
return this.transitionTo('posts');
}
},
@efigarolam
efigarolam / attrdecl.rb
Created October 13, 2013 03:50
AttrDecl Nokogiri
require 'nokogiri'
# First I create an XML example.
# The Nokogiri::XML::AttributeDecl represents an attribute declaration in a DTD
# The following example has 3 attributes declarations each one represented
# by <!ATTLIST element-name attribute-name attribute-type attribute-value>
# you can read about DTD and XML for further references.
xml = <<eostr
<?xml version="1.0"?><?TEST-STYLE PIDATA?>
@efigarolam
efigarolam / gist:6430899
Created September 3, 2013 23:19
Upgrading Ember.js assets
be rails generate ember:install --head
@efigarolam
efigarolam / seeds.rb
Last active December 21, 2015 20:09
Seed file for EmberBlog application.
users = User.create([
{
name: 'Your name',
last_name: 'Your last name',
email: 'your@email.com',
admin: true,
active: true
}
])
@efigarolam
efigarolam / phone_book_spec.rb
Last active December 11, 2015 13:38
phone_book_spec.rb
require 'spec_helper'
describe PhoneBook do
before {
@valid_attrs = { name: "Juan", last_name: "Perez", phone: "999-99-9-99-99", address: "Col. Vista Hermosa", age: 10 }
}
context "model validations" do
it "must be valid with all the attributes" do
phone_book = PhoneBook.new @valid_attrs