Skip to content

Instantly share code, notes, and snippets.

View fcoury's full-sized avatar

Felipe Coury fcoury

View GitHub Profile
@fcoury
fcoury / .gitignore
Created August 8, 2012 19:15 — forked from creationix/.gitignore
ddns + nat forwarding
node_modules
secrets.js
class Person < ActiveRecord::Base
def full_name
"#{self.first_name} #{self.last_name}"
end
end
class Person < ActiveRecord::Base
def full_name
“#{self.name} #{self.last_name}”
end
end
@fcoury
fcoury / personality.rb
Created April 13, 2012 02:21 — forked from wycats/personality.rb
More technical details about the discussion at last nights meetup
# Just wanted to clarify my points at the meetup last night.
#
# There were two different issues intertwined:
# (1) Whether to use extend or "include as extend"
# (2) When using "include as extend", what is the simplest way to achieve the goal?
#
# My personal opinion is that the answer to (1) is "extend", not "include as extend", but that
# is just my personal opinion. My answer to (2) is a more empirical question.
# Using the "extend" approach. Again, I personally prefer the simplicity of this approach, but
@fcoury
fcoury / gist:2206678
Created March 26, 2012 17:19 — forked from thattommyhall/gist:2205969
fpm ruby 1.9.3
apt-get install libreadline-dev
./configure --prefix=/usr && make && make install DESTDIR=/tmp/ruby193
fpm -s dir -t deb -n ruby -v 1.9.3-p125 -C /tmp/ruby193 \
-p ruby-VERSION_ARCH.deb -d "libstdc++6 (>= 4.4.3)" \
-d "libc6 (>= 2.6)" -d "libffi5 (>= 3.0.4)" -d "libgdbm3 (>= 1.8.3)" \
-d "libncurses5 (>= 5.7)" -d "libreadline6 (>= 6.1)" \
-d "libssl0.9.8 (>= 0.9.8)" -d "zlib1g (>= 1:1.2.2)" \
usr/bin usr/lib usr/share/man usr/include
def update
if params[:webby][:hostname]
update_hostname
else
@webby.update_attributes extract_params
end
respond_with(@webby)
end
events:
# outros eventos aki
'click #hostname' : 'showEditHostnameForm'
'click #cancel_update_hostname' : 'cancelEditHostnameForm'
'click #update_hostname' : 'update_hostname'
update_hostname: (e) ->
e.preventDefault()
hostname = $('#webby_hostname').val()
@model.save
@fcoury
fcoury / config.ru
Created February 29, 2012 20:15
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
require "rails"
# Let's load only action controller. If you want
# to use active record, just require it as well.
require "action_controller/railtie"
class MyApp < Rails::Application
require File.expand_path('../../../spec_helper', __FILE__)
require './app/services/invoice/create_service'
class InvoiceForCreateService
include Invoice::CreateService
attr_reader :userid
end
class InvoiceCreationError < StandardError; end
class Client
# (..)
def add_prepaid_credit(amount)
invoice_fields = { 'duedate' => Date.today,
'autoapplycredit' => false,
'itemdescription1' => 'Prepaid credit',
'itemamount1' => amount }
response = create(invoice_fields)