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
| module Colors | |
| def colorize(text, color_code) | |
| "\033[#{color_code}m#{text}\033[0m" | |
| end | |
| { | |
| :black => 30, | |
| :red => 31, | |
| :green => 32, | |
| :yellow => 33, |
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
| # Vista | |
| a href="/services/jobs/new" data-behavior="add_service" | |
| # Routes | |
| get '/services/:root/new', to: 'services#new' | |
| # Controller | |
| def new | |
| render partial: "services/new_#{params[:root]}" | |
| 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
| li.score | |
| .box-left | |
| .box-line | |
| - if service.premium? | |
| i.icon-star.premium-service | |
| span = service.title | |
| .box-line | |
| span Add a Comment |
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
| module Checkout::Base | |
| extend ActiveSupport::Concern | |
| included do | |
| expose(:cc_dummy_data) { cc_data } | |
| respond_to :json | |
| end | |
| def create | |
| build_resource |
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(); |
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
| # 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
| 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
| 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
| <!-- Sin Alias --> | |
| <div ng-controller="CustomersController"> | |
| <ul> | |
| <li ng-repeat="customer in customers"> | |
| {{ customer.name }} | |
| </li> | |
| </ul> | |
| </div> | |
| <script> |