This file contains 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
- @shipping_methods.each do |method| | |
%p | |
= f.radio_button :shipping_method, method.service_code | |
= f.label :shipping_method, method.service_name, value: method.service_code | |
This file contains 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
@products.each_with_index do |p, i| | |
p.update_attribute(:date_available, i.minutes.ago) | |
end |
This file contains 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
<form accept-charset="UTF-8" action="https://www.alipay.com/cooperate/gateway.do" id="payment-form" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div> | |
<input id="out_trade_no" name="out_trade_no" type="hidden" value="123456" /> | |
<input id="partner" name="partner" type="hidden" value="20887XXX910XXX97" /> | |
<input id="total_fee" name="total_fee" type="hidden" value="0.01" /> | |
<input id="seller_email" name="seller_email" type="hidden" value="[email protected]" /> | |
<input id="notify_url" name="notify_url" type="hidden" value="http://127.0.0.1:3000/en-US?action=notify&controller=store%2Fcheckout%2Falipay" /> | |
<input id="return_url" name="return_url" type="hidden" value="http://127.0.0.1:3000/en-US?action=done&controller=store%2Fcheckout%2Falipay" /> | |
<input id="show_url" name="show_url" type="hidden" value="http://127.0.0.1:3000/en-US?action=show&controller=store%2Fcheckout%2Falipay" /> |
This file contains 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
# Controller | |
class PostsController < ApplicationController | |
before_filter :authenticate_user!, :except => [:show, :index] | |
autocomplete :tag, :name | |
end | |
# Routes: | |
resources :posts do |
This file contains 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 json_for_autocomplete(items, method, extra_data=[]) | |
items.collect do |item| | |
# | |
# Esta es la linea que importa, le estás diciendo a autocomplete que use nitprovedor como value | |
# | |
hash = {"id" => item.id.to_s, "label" => item.send(method), "value" => item.nitproveedor} | |
extra_data.each do |datum| | |
hash[datum] = item.send(datum) | |
end |
This file contains 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
# | |
# Rails 3.1 | |
# | |
def force_ssl(options = {}) | |
before_filter(options) do | |
if !request.ssl? && !Rails.env.development? | |
redirect_to :protocol => 'https://', :status => :moved_permanently | |
end | |
end |
This file contains 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
# | |
# Uso: | |
# | |
# ruby digitos.rb 1980 1987 | |
# | |
puts (ARGV[0]..ARGV[1]).select {|n| n.chars.to_a.uniq.size == n.size}.size |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace SG___Code_1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
This file contains 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
require 'spec_helper' | |
describe Spree::Config do | |
before do | |
ActionController::Base.perform_caching = true | |
# config.cache_store = :dalli_store, { expires_in: 5.seconds } | |
end | |
it "Should fallback to database if cache keys expire" do | |
Spree::Config.featured_sale_id = 10 |