Skip to content

Instantly share code, notes, and snippets.

require 'spreadsheet'
class CategoryXls
def initialize(file_path)
@file_path = file_path
end
def import
read( @file_path ) do |sheet, row|
@gramos
gramos / Moldel
Last active August 29, 2015 14:11
def self.import(file)
CSV.foreach(file, headers: true) do |row|
csv = row.to_hash
#default values
order_type = csv["Shipping Method"].to_s.include?('Pickup') || csv["Shipping Method"].to_s == '' ?
0 : 1
order_date = csv["Fulfilled at"].to_s == '' ? Time.now :
DateTime.strptime(csv["Fulfilled at"].to_s, "%m/%d/%Y %H:%M")
<VirtualHost *:80>
ServerAlias subdom.dominio.com www.subdom.dominio.com
ServerAdmin webmaster@subdom.dominio.com
DocumentRoot /home/x081vm19/public_html/subdom
ServerName www.subdom.dominio.com
CustomLog domlogs/subdom.dominio.com-access_log combined
LogFormat "%{%s}t %B ." bytes_count
CustomLog domlogs/x081vm19-bytes_log bytes_count
#ScriptAlias /cgi-bin/ /home/x081vm19/public_html/subdom/cgi-bin/
@gramos
gramos / ruby_for_non-programers.markdown
Last active December 16, 2015 06:59 — forked from olvap/ruby_for_non-programers.markdown
Ruby para no programadores

Ruby para no programadores

Tema: Introducción a Ruby

Como la gente que no programa (day-walkers) puede ahorrar tiempo automatizando cosas. Como trabajar con archivos de texto, generar planillas y más!

module ParanoidDeletion
def self.included(klass)
klass.send :include, InstanceMethods
klass.send :extend, ClassMethods
klass.send :default_scope, klass.where(deleted_at: nil)
end
module InstanceMethods
def destroy_without_callbacks