Skip to content

Instantly share code, notes, and snippets.

module ApplicationHelper
#
# Return the colums style
#
def get_column_style
return 3 if products_index
return 'left' if products_show || taxons_show
return 'right' if products_show
1
@jparbros
jparbros / gist:aa1aa35e5a3c5585c9e6
Created September 18, 2014 21:56
borrar tablas JS
drop table if exists "schema_migrations" cascade;
drop table if exists "spree_addresses" cascade;
drop table if exists "spree_adjustments" cascade;
drop table if exists "spree_alternate_catalog_numbers" cascade;
drop table if exists "spree_assets" cascade;
drop table if exists "spree_brands" cascade;
drop table if exists "spree_calculators" cascade;
drop table if exists "spree_color_groups" cascade;
drop table if exists "spree_color_groups_option_values" cascade;
drop table if exists "spree_option_types" cascade;
oz = Spree::Country.find_by_iso('AU')
oz.states << Spree::State.create(:name => 'Australian Capital Territory', :abbr => 'ACT')
oz.states << Spree::State.create(:name => 'New South Wales', :abbr => 'NSW')
oz.states << Spree::State.create(:name => 'Victoria', :abbr => 'VIC')
oz.states << Spree::State.create(:name => 'Tasmania', :abbr => 'TAS')
oz.states << Spree::State.create(:name => 'Queensland', :abbr => 'QLD')
oz.states << Spree::State.create(:name => 'South Australia', :abbr => 'SA')
oz.states << Spree::State.create(:name => 'Western Australia', :abbr => 'WA')
oz.states << Spree::State.create(:name => 'Northern Territory', :abbr => 'NT')
gb = Spree::Country.find_by_iso('GB')
gb.states << Spree::State.create(abbr: 'ABD', name:'Aberdeenshire')
gb.states << Spree::State.create(abbr: 'AGY', name:'Anglesey')
gb.states << Spree::State.create(abbr: 'ALD', name:'Alderney')
gb.states << Spree::State.create(abbr: 'ANS', name:'Angus')
gb.states << Spree::State.create(abbr: 'ANT', name:'Co. Antrim')
gb.states << Spree::State.create(abbr: 'ARL', name:'Argyllshire')
gb.states << Spree::State.create(abbr: 'ARM', name:'Co. Armagh')
gb.states << Spree::State.create(abbr: 'AVN', name:'Avon')
gb.states << Spree::State.create(abbr: 'AYR', name:'Ayrshire')
@jparbros
jparbros / gist:5bcde05c55653bb174dd
Last active August 29, 2015 14:09
Code Retrear 2014 Colima
Code Retreat 2014 Colima
Ejercicio: KataBankOCR
http://codingdojo.org/cgi-bin/index.pl?KataBankOCR
Los primeros 10 minutos de cada iteración en papel.
Una caja lápices
Borradores
worker_processes 4;
events {
worker_connections 1024;
}
client_body_buffer_size 256K;
client_header_buffer_size 64k;
client_max_body_size 8m;
large_client_header_buffers 8 1024k;
window.confirmSetted = false;
function getAjaxCart() {
jQuery.ajax({
url: minicart_url,
dataType: 'json',
type : 'get',
success: function(data){
var div_element = jQuery("<div>");
jQuery(div_element).html(data.html);
(82.0ms) SELECT SUM("spree_payments"."amount") AS sum_id FROM "spree_payments" WHERE "spree_payments"."order_id" = $1 AND "spree_payments"."state" = 'completed' [["order_id", 1044]]
(1.6ms) SELECT SUM(price * quantity) AS sum_id FROM "spree_line_items" WHERE "spree_line_items"."order_id" = $1 [["order_id", 1044]]
(6.7ms) SELECT SUM("spree_shipments"."cost") AS sum_id FROM "spree_shipments" WHERE "spree_shipments"."order_id" = $1 [["order_id", 1044]]
Spree::Adjustment Load (2.8ms) SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE (order_id = 1044 OR (adjustable_id = 1044 AND adjustable_type = 'Spree::Order'))
(2.0ms) SELECT SUM("spree_line_items"."adjustment_total") AS sum_id FROM "spree_line_items" WHERE "spree_line_items"."order_id" = $1 [["order_id", 1044]]
(2.0ms) SELECT SUM("spree_shipments"."adjustment_total") AS sum_id FROM "spree_shipments" WHERE "spree_shipments"."order_id" = $1 [["order_id", 1044]]
(3.9ms) SELECT SUM("spree_adjustments"."amount") AS sum
@jparbros
jparbros / wdt_talks_history.md
Last active August 29, 2015 14:13
Historial de platicas WDT

Sesion #1 - Julio 2013

  • Introduccion a nodejs por Narciso Guillen
  • JavaScript callbacks en Ruby por Juan Antonio Chavez
  • Manifiesto del desarrollador de software mexicano por Emanuel delgado
  • Ignacio Galindo

Sesion #2 - Agosto 2013

  • Heriberto Perez
  • Jonathan Garay
  • Jaime Gonzalez
module BoxBound
extend ActiveSupport::Concern
def get_bounds
curl = Curl::Easy.new
curl.url = 'http://cartografia.ife.org.mx/sige/ajax/get_searchv5'
curl.headers = {'Content-Type' => 'application/x-www-form-urlencoded'}
curl.http_post("e=6&q=#{section}&t=seccion&c=SECCION")
Yajl::Parser.parse(curl.body.split('|')[1])
end