Skip to content

Instantly share code, notes, and snippets.

View fedesoria's full-sized avatar

Federico Soria fedesoria

View GitHub Profile
[1] pry(#<Merchant>)> stripe_customer = Stripe::Customer.retrieve(stripe_customer_id)
=> #<Stripe::Customer:0x3ffdb902b8bc id=cus_7i3TMi5sqH78iY> JSON: {
"id" : "cus_7i3TMi5sqH78iY",
"object" : "customer",
"account_balance" : 0,
"bank_accounts" : {
"object" : "list",
"data" : [
{
"id" : "ba_82xZOcvz6SNFx9",
pry(#<Merchant>)> stripe_customer.sources.all
=> #<Stripe::ListObject:0x3fe9f4977f34> JSON: {
"object" : "list",
"data" : [],
"has_more" : false,
"url" : "/v1/customers/cus_7i3TMi5sqH78iY/sources"
}
[2] pry(#<Merchant>)> stripe_customer.sources.all
=> #<Stripe::ListObject:0x3fe9f47c0218> JSON: {
"object" : "list",
@fedesoria
fedesoria / gist:7934902
Created December 12, 2013 20:30
Sublime Text - User Text Bindings
[
{ "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
{ "keys": ["super+b"], "command": "toggle_side_bar" },
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["super+."], "command": "gitx_open" },
{ "keys": ["ctrl+shift+."], "command": "erb" },
{"keys": ["super+shift+t"], "command": "reopen_last_file"},
{
"args": {
@fedesoria
fedesoria / gist:7934894
Created December 12, 2013 20:30
Sublime Text - Preferences User
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme",
"fade_fold_buttons": false,
"file_exclude_patterns":
[
"*.tmTheme.cache",
"*.tmPreferences.cache",
@fedesoria
fedesoria / through_polymorphic.rb
Last active December 27, 2015 05:19
What I'm I doing wrong?
class User
has_many :parameter_values, as: :valuable
has_many :parameters,-> { uniq }, :through => :parameter_values
end
class ParameterValue
belongs_to :parameter
belongs_to :valuable, :polymorphic => true
end

Capybara

save_and_open_page

Matchers

have_button(locator)
@fedesoria
fedesoria / test_routes.rb
Created February 2, 2013 00:57
Test routes on console
# include routing and URL helpers
include ActionDispatch::Routing
include Rails.application.routes.url_helpers
# use routes normally
users_path #=> "/users"
@fedesoria
fedesoria / checkin_server.rb
Created September 12, 2012 02:28
stream in sinatra
class CheckinServer < Sinatra::Base
include Paperclip::Glue
set :server, :thin
set :views, settings.root + '/../app/views/sinatra'
connections = []
@fedesoria
fedesoria / chubas.coffee
Created June 19, 2012 05:05
window variables
window.variable = "foo"
en vez de
variable = "foo"
y asi lo puedes llamar desde donde sea como
window.variable
class User
after_initialize :init
def init
self.number ||= 0.0 #will set the default value only if it's nil
end
end