Skip to content

Instantly share code, notes, and snippets.

View agustinf's full-sized avatar

Agustin Feuerhake agustinf

View GitHub Profile
//If we have a module (here called users.js) that defines actions such as index, show, edit, etc. we pass it as the second parameter for app.resource().
users_resource = app.resource('users', require('./modules/users.js'));
//We don't have a module, but we will map functions manually later. Notice we define the base:"/api" here.
users_resource = app.resource('others', {base:'/api'});
@agustinf
agustinf / gist:7431101
Created November 12, 2013 13:50
Moving yaml locale to database
# unnest will let me flatten a Hash
class Hash
def unnest
new_hash = {}
each do |key,val|
if val.is_a?(Hash)
new_hash.merge!(val.prefix_keys("#{key}."))
else
new_hash[key] = val
end
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
GIT
remote: git://github.com/gregbell/active_admin.git
revision: 66de2f86ae1d541adf79ca95c3e97c74d9d9c9da
specs:
activeadmin (1.0.0.pre)
arbre (~> 1.0)
bourbon
coffee-rails
devise (~> 3.2)
formtastic (~> 2.3.0.rc2)
@agustinf
agustinf / agustin.png
Last active November 15, 2016 02:23
Chat con un cliente Fintual
agustin.png

**pedro** [4:21 PM] joined #z-**santiago-cl**-12.

**santiago-cl** [4:21 PM] Hola

[4:21]
@agustinf
agustinf / banana_ticket.md
Last active November 22, 2016 19:59
Un desafío Platanus

Banana Ticket

Te llaman por teléfono y te avisan que viene aterrizando Bob Dylan de sorpresa en tu país. Quiere dar un concierto pero no está dispuesto a usar una ticketera existente, quiere que tú construyas una ticketera para usar en el resto de su gira con sus amigos artistas. Pero solo tienes 1 hora y media hasta que llegue Bob!

Luego de preguntar, averiguas lo siguiente:

  • Bob piensa administrar la ticketera personalmente, y él puede usar la consola de Rails.
  • Un evento puede tener más de un artista.
  • Un evento tiene un nombre.
  • Cada evento tiene una fecha y hora.
  • Cada evento tiene n tickets asociados, todos con el mismo precio en dólares.
@agustinf
agustinf / gist:4a930790d5f5e137061a4354294fdb2d
Last active August 7, 2017 21:37
delete_people_using_csv.rb
require 'csv'
include PersonCsvHelper
class DeletePeopleUsingCsv < PowerTypes::Command.new(:file_path)
def perform
for_each_row do |row|
Rails.logger.info("doing the thing")
next unless row[:email]
person = Person.find_by(email: row[:email])
@agustinf
agustinf / buda_request.rb
Last active February 6, 2019 14:04
Signs a request in ruby
require "base64"
require "digest"
require "net/http"
require "uri"
require "JSON"
PRIVATE = ARGV[1]
PUBLIC = ARGV[2]
def gen_nonce
# Sleeps 200ms to avoid flooding the server with requests.