This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Linkedin | |
include HTTParty | |
base_uri 'https://api.linkedin.com/v2' | |
def initialize(token) | |
@token = token | |
end | |
def me | |
self.class.get('/me', options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### pfx to pem, complete edition: | |
$ openssl pkcs12 -in filename.pfx -nocerts -out key.pem | |
$ openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem | |
$ openssl pkcs12 -in filename.pfx -cacerts -out ca_cert.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.3@orcamentorapido mergulhao@darkstar:~/code/startupdev/orcamentorapido(master)$ rake stats | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 134 | 126 | 6 | 21 | 3 | 4 | | |
| Helpers | 2 | 2 | 0 | 0 | 0 | 0 | | |
| Models | 168 | 146 | 8 | 14 | 1 | 8 | | |
| Libraries | 15 | 13 | 0 | 1 | 0 | 11 | | |
| Model specs | 451 | 439 | 0 | 2 | 0 | 217 | | |
| Controller specs | 540 | 530 | 0 | 24 | 0 | 20 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basta rodar os 2 comandos abaixo no console e reiniciar. | |
# Mais coisas legais em https://gist.github.com/2260182 | |
defaults write NSGlobalDomain KeyRepeat -int 0.02 | |
defaults write NSGlobalDomain InitialKeyRepeat -int 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
require 'spec_helper' | |
describe User do | |
describe :scopes do | |
describe :want_email_notifications do | |
create!(:user__want) { {email_notifications: true} } | |
create!(:user__notwant) { {email_notifications: false} } | |
subject { User.want_email_notifications } | |
it { should include(user__want) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
require "spec_helper" | |
describe Notification do | |
describe "new_question" do | |
let(:user) { Factory.create(:user, name: 'Dart Vader', email: '[email protected]') } | |
let(:category) { Factory.create(:category, name: 'Saúde') } | |
let(:owner) { Factory.create(:user, name: 'Jaspion') } | |
let(:question) { Factory.create(:question, user: owner, category: category) } | |
let(:mailer) { Notification.new_question(question.id, user.id) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseJob < Struct.new(:params) | |
def perform | |
send(params[:action]) | |
rescue Exception => exception | |
Airbrake.notify(exception, { | |
api_key: ENV['AIRBRAKE_API_KEY'] | |
}) | |
raise exception | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'builder' | |
require 'digest/md5' | |
class Content < ActiveRecord::Base | |
belongs_to :user | |
end | |
class Section < ActiveRecord::Base | |
has_many :assigned_sections | |
has_many :articles, :order => 'position', :through => :assigned_sections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export AMAZON_S3_BUCKET=mybucket-development | |
export AMAZON_ACCESS_KEY_ID=xxx | |
export AMAZON_SECRET_ACCESS_KEY=xxx | |
rvm 1.9.2@nome-da-app --create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FIX for this issue | |
# https://github.com/thoughtbot/shoulda-matchers/commit/6b4035c11783a0588e78d3705bb9425b9b5f45b8 | |
Shoulda::Matchers::ActiveRecord::AssociationMatcher.class_eval do | |
protected | |
def foreign_key | |
reflection.respond_to?(:foreign_key) ? reflection.foreign_key : reflection.primary_key_name | |
end | |
end |
NewerOlder