This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Validator | |
| attr_reader :errors | |
| def initialize(v1, v2) | |
| @v1 = v1 | |
| @v2 = v2 | |
| @errors = [] | |
| end | |
| def validate! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| var len = 100; | |
| var p = $("[data-id='truncate']"); | |
| if (p) { | |
| var trunc = p.html(); | |
| if (trunc.length > len) { | |
| trunc = trunc.substring(0, len); | |
| trunc = trunc.replace(/\w+$/, ''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| La consigna es llegar hasta la opción seleccionada en select.form-control, | |
| pero partiendo desde el checkbox | |
| --> | |
| <div class="member-option member-no-signup"> | |
| <div class="member-checkbox"> | |
| <input data-behavior="add_membership" name="option" type="checkbox" value=""> | |
| </div> | |
| <div class="member-content"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :images do | |
| namespace :portfolio do | |
| desc "Reprocess PortfolioImage in order to calculate and save image dimensions" | |
| task :generate_dimensions => [:environment] do | |
| exceptions = [] | |
| failures = [] | |
| logger = ActiveSupport::BufferedLogger.new(Rails.root.join("log", "reprocess_portfolio.log")) | |
| scope = User.sellers.is_published.where(:show_on_hdr => true) | |
| if ids = ENV["ID"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Sin Alias --> | |
| <div ng-controller="CustomersController"> | |
| <ul> | |
| <li ng-repeat="customer in customers"> | |
| {{ customer.name }} | |
| </li> | |
| </ul> | |
| </div> | |
| <script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var NotificationsService = function () { | |
| this.MAX_LEN = 10; | |
| this.notificationsArchive = new NotificationsArchive(); | |
| this.notifications = []; | |
| }; | |
| NotificationsService.prototype.push = function (notification) { | |
| var newLen, notificationToArchive; | |
| newLen = this.notifications.unshift(notification); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def search_results_for(attributes) | |
| rtn = [] | |
| attempt = 1 | |
| while rtn.empty? && attempt <= 3 | |
| rtn = index.search(attributes, attempt) | |
| attempt += 1 | |
| end | |
| rtn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # No tiene sentido hacer tan verbosa la acción, no usa bien el respond_with | |
| def create | |
| user = User.new(user_params) | |
| if user.save | |
| render json: user, status: 201, location: [:api, user] | |
| else | |
| render json: { errors: user.errors }, status: 422 | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| show_autocomplete: function (itemName, collection) { | |
| $('.' + itemName).autocomplete({ | |
| source: function (request, response) { | |
| var contains1, containsMatcher1, startsWith1, startsWithMatcher1, term; | |
| term = $.ui.autocomplete.escapeRegex(request.term); | |
| startsWithMatcher1 = new RegExp('^' + term, 'i'); | |
| startsWith1 = $.grep(collection, function (value) { | |
| return startsWithMatcher1.test(value.label || value.value || value); | |
| }); | |
| containsMatcher1 = new RegExp('\\b' + term, 'i'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| "use strict" | |
| awcp.behaviors.checkout = function(container) { | |
| var behavior = { | |
| init: function() { | |
| behavior.submitBtn = $('button.btn.btn-default'); | |
| behavior.addClickListener(); |