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!
require 'spreadsheet' | |
class CategoryXls | |
def initialize(file_path) | |
@file_path = file_path | |
end | |
def import | |
read( @file_path ) do |sheet, row| |
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/ |
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 |