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
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"]
<!--
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">
$(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+$/, '');
class Validator
attr_reader :errors
def initialize(v1, v2)
@v1 = v1
@v2 = v2
@errors = []
end
def validate!
# Which one is your preferred syntax?
# Indentation 1
class Dummy
def public_method
end
private
def private_method
end
<img
alt=""
class="producto-imagen"
src="productos/obtenerimagen/?id=5&amp;useDensity=true&amp;width=640&amp;height=360&amp;tipoEscala=contain"
data-bind="ghostTo: agregandoACarrito, ghostToTarget: $('.cartCount'), attr:{width: width, ___height: height}, src:imagenes.representativa &amp;&amp; imagenes.representativa() &amp;&amp; imagenes.representativa().get &amp;&amp; imagenes.representativa().get({width: width, height: height, tipoEscala: 'contain', useDensity: true}) || '/img/px.gif'"
width="640"
___height="360"
>
# 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]
# 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
# app/controllers/videos_controller.rb
def destroy
video = Video.find params[:id]
video.destroy if video
render :nothing => true
end
# config/routes.rb
resources :photos, only: [:create]
resources :videos, only: [:create]