Skip to content

Instantly share code, notes, and snippets.

View sanchojaf's full-sized avatar

Miguel Sancho Fernandez sanchojaf

View GitHub Profile
@sanchojaf
sanchojaf / gist:47c5f149b8f651125f2a
Last active August 29, 2015 14:04
for send credit card through wombat
#spree_wombat
#===========
require 'active_model/serializer'
module Spree
module Wombat
class SourceSerializer < ActiveModel::Serializer
attributes :name, :cc_type, :last_digits, :month, :year
Miguels-MacBook-Air:peach_unified sancho$ rake db:migrate:redo
/Users/sancho/.rvm/gems/ruby-2.1.2@peach_ecom/gems/activerecord-4.1.4/lib/active_record/associations.rb:1585: warning: already initialized constant Spree::Store::HABTM_Products
/Users/sancho/.rvm/gems/ruby-2.1.2@peach_ecom/gems/activerecord-4.1.4/lib/active_record/associations.rb:1585: warning: previous definition of HABTM_Products was here
/Users/sancho/.rvm/gems/ruby-2.1.2@peach_ecom/gems/activerecord-4.1.4/lib/active_record/associations.rb:1585: warning: already initialized constant Spree::Product::HABTM_Stores
/Users/sancho/.rvm/gems/ruby-2.1.2@peach_ecom/gems/activerecord-4.1.4/lib/active_record/associations.rb:1585: warning: previous definition of HABTM_Stores was here
== 20141006195009 CreateMultipleStores: reverting =============================
== 20141006195009 CreateMultipleStores: reverted (0.0000s) ====================
== 20141006195009 CreateMultipleStores: migrating =============================
rake aborted!
@sanchojaf
sanchojaf / gist:dc1a28606120d5a56099
Last active August 29, 2015 14:14
play_with_action_view
view = ActionView::Base.new
view.formats
=> [:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip]
ActionView::Base.new.render(inline: "Hello world!")
=> "Hello world!"
view.render(inline: "<h1> <%= 4 +1 %> Hello world!</h1>")
=> "<h1> 5 Hello world!</h1>"
@sanchojaf
sanchojaf / gist:ae95a22036bb5ecca835
Last active August 29, 2015 14:17
config/unicorn.rb
# Set your full path to application.
app_dir = File.expand_path('../../', __FILE__)
shared_dir = File.expand_path('../../../shared/', __FILE__)
app_name = "foo"
# Set unicorn options
worker_processes 2
preload_app true
timeout 30
@sanchojaf
sanchojaf / gist:2b87be1df00a1e25bcb1
Last active August 29, 2015 14:17
/etc/nginx/sites-enabled/default
upstream app_1 {
# Path to Unicorn SOCK file, as defined previously
server unix:/home/deploy/app_1/shared/sockets/unicorn.app_1.sock fail_timeout=0;
}
server {
# Application root, as defined previously
root /home/deploy/app_1/public;
server_name www.app_1.com app_1.com;
DIMENSION_INDEX = { band: 0, bust: 1, across_cup_left: 2, across_cup_right: 3, around_upper_chest: 4, fit_bra_size: 5, bmi: 6,
bust_point_to_bust_point: 7, around_upper_chest: 8, across_upper_chest: 9, around_back: 10, nape_to_waist: 11, bridge: 12 }
# For weigh is possible ser a value between [0,1].
# INDEX = [ 00,01,02,03,04,05,06,07,08,09,10,11, 12 ]
BAND_WEIGH = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
CUP_WEIGH = [ 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ]
BAND_AND_CUP_WEIGH = [ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ]
ALL_WEIGH = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
@sanchojaf
sanchojaf / gist:95bc28f09368b4084592
Created May 3, 2015 12:19
ISO-3366-1: Alpha-2 Codes
<select>
<option value="AF">Afghanistan</option>
<option value="AX">Åland Islands</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
@sanchojaf
sanchojaf / gist:227209146cdb08182276
Created May 3, 2015 12:20
ISO-3366-1: Alpha-3 Codes
<select>
<option value="AFG">Afghanistan</option>
<option value="ALA">Åland Islands</option>
<option value="ALB">Albania</option>
<option value="DZA">Algeria</option>
<option value="ASM">American Samoa</option>
<option value="AND">Andorra</option>
<option value="AGO">Angola</option>
<option value="AIA">Anguilla</option>
<option value="ATA">Antarctica</option>
@sanchojaf
sanchojaf / gist:7f5c7ae949f210118343
Created May 3, 2015 12:21
ISO-3366-1: Numeric Codes
<select>
<option value="4">Afghanistan</option>
<option value="248">Åland Islands</option>
<option value="8">Albania</option>
<option value="12">Algeria</option>
<option value="16">American Samoa</option>
<option value="20">Andorra</option>
<option value="24">Angola</option>
<option value="660">Anguilla</option>
<option value="10">Antarctica</option>
@sanchojaf
sanchojaf / gist:e77b350b0a6a5adad02d
Created May 3, 2015 12:22
ISO-3166-2 - Alpha Codes
<select>
<option value="ISO 3166-2:AF">Afghanistan</option>
<option value="ISO 3166-2:AX">Åland Islands</option>
<option value="ISO 3166-2:AL">Albania</option>
<option value="ISO 3166-2:DZ">Algeria</option>
<option value="ISO 3166-2:AS">American Samoa</option>
<option value="ISO 3166-2:AD">Andorra</option>
<option value="ISO 3166-2:AO">Angola</option>
<option value="ISO 3166-2:AI">Anguilla</option>
<option value="ISO 3166-2:AQ">Antarctica</option>