Skip to content

Instantly share code, notes, and snippets.

View jnettome's full-sized avatar
🏠
Working from home

João Pedro Netto jnettome

🏠
Working from home
View GitHub Profile
@jnettome
jnettome / scraper.rb
Created June 13, 2016 16:00 — forked from Zanfa/scraper.rb
AngelList scraper
require 'open-uri'
require 'angellist_api'
require 'mongoid'
# Load the Startup model
require File.expand_path(File.dirname(__FILE__) + '/app/models/startup')
Mongoid.load!('config/mongoid.yml', :development)
page = 1
startup_ids = []
@jnettome
jnettome / BitmaskOptions (concern)
Created October 19, 2015 21:48
BitmaskOptions
module BitmaskOptions
extend ActiveSupport::Concern
include ActiveModel::Serialization
included do
mattr_accessor :all_options, :all_option_pairs, instance_writer: false
end
# This is a low level method that usually won't be used in public methods
#http://railscasts.com/episodes/189-embedded-association
require 'spec_helper'
shared_examples_for 'bitmask_options' do
# http://stackoverflow.com/questions/16525222/how-to-test-a-concern-in-rails#answer-20010923
# http://stackoverflow.com/questions/25562639/rspec-testing-ar-model-concern-within-described-class-or-dummyclass
let(:model) { described_class } # the class that includes the concern
has_attributes :bitmask_options
it 'has at least one option' do
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",