Skip to content

Instantly share code, notes, and snippets.

View dbarrionuevo's full-sized avatar

Darío Barrionuevo dbarrionuevo

  • San Miguel de Tucumán
View GitHub Profile
{
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store",
".tags*",
"*.pyc",
"*.pyo",
"*.exe",
"*.dll",
@dbarrionuevo
dbarrionuevo / rspec_model_testing_template.rb
Last active July 27, 2017 16:38 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails.
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
describe Model do
# Lazily loaded to ensure it's only used when it's needed
# Try to avoid @instance_variables if possible. They're slow.
let(:factory_instance) { build(:some_factory) }
describe 'ActiveRecord validations' do
// Update subtotal and total amounts on checkout, considering fees
GrowDough.Behaviors.UpdateTotal = Essential.Behavior.extend({
init: function() {},
events: {
'keyup': 'updateSubtotal'
},
updateSubtotal: function(e, force) {
// Keys and events on which the behavior has to update totals
/ app/views/organizations/signup_modules/_organization.html.slim
= f.fields_for :organization, @resource.build_organization do |org|
.row
.col-md-12
= org.label :name, '* Organization Name'
= org.text_field :name, validators: { not_empty: true }, autofocus: true
<!-- Este tiene el bh que carga TransacSearchMembers -->
<a class="ura peluda">
<div class="box-right">
<form data-behavior="transac_search_add" id="407" action="..." method="post">
...
...
</form>
</div>
</a>
Apipie.configure do |config|
reload_controllers = Rails.env.development?
end
YouConnect.Behaviors.AddService = Essential.Behavior.extend({
init: function() {
this.category = $('#category_id');
this.addCategoryListener();
},
events: {
'submit': 'addFormListener'
},
# db/seeds/01_service_categories.rb
puts "===================================================="
puts "Service Categories"
puts "===================================================="
jobs = ServiceCategory.where(name: "Jobs", code: "J").first_or_create
education = ServiceCategory.where(name: "Education", code: "E").first_or_create
business = ServiceCategory.where(name: "Business", code: "B").first_or_create
social = ServiceCategory.where(name: "Social", code: "S").first_or_create
# .............
// Not implemented yet!
(function($) {
"use strict"
youconnect.behaviors.in_a_future_release = function(container) {
var behavior = {
init: function() {
behavior.addClickListener();
},
xx = [1,2,3]
=> [1, 2, 3]
yy = xx
=> [1, 2, 3]
yy.delete 2
=> 2
yy