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
| <!-- | |
| 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
| $(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
| 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
| # Which one is your preferred syntax? | |
| # Indentation 1 | |
| class Dummy | |
| def public_method | |
| end | |
| private | |
| def private_method | |
| 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
| <img | |
| alt="" | |
| class="producto-imagen" | |
| src="productos/obtenerimagen/?id=5&useDensity=true&width=640&height=360&tipoEscala=contain" | |
| data-bind="ghostTo: agregandoACarrito, ghostToTarget: $('.cartCount'), attr:{width: width, ___height: height}, src:imagenes.representativa && imagenes.representativa() && imagenes.representativa().get && imagenes.representativa().get({width: width, height: height, tipoEscala: 'contain', useDensity: true}) || '/img/px.gif'" | |
| width="640" | |
| ___height="360" | |
| > |
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
| # app/controllers/sessions_controller.rb | |
| class SessionsController < ApplicationController | |
| def login | |
| if current_user | |
| redirect_to root_path | |
| return | |
| end | |
| @redirect_path = { path: "/auth/facebook", message: { notice: "Logged in successfully" } } | |
| parse_to_path if params[:to] | |
| redirect_to @redirect_path[:path], @redirect_path[:message] |
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
| # app/controllers/sessions_controllers.rb | |
| def login | |
| url = "/auth/facebook" | |
| url += "?" + params.try(:to_param) if params | |
| session[:from] = params[:to] if params.any? | |
| redirect_to url #unless user_signed_in? | |
| 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
| # app/controllers/videos_controller.rb | |
| def destroy | |
| video = Video.find params[:id] | |
| video.destroy if video | |
| render :nothing => true | |
| 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
| # config/routes.rb | |
| resources :photos, only: [:create] | |
| resources :videos, only: [:create] |