Skip to content

Instantly share code, notes, and snippets.

View oriolgual's full-sized avatar

Oriol Gual oriolgual

View GitHub Profile
@oriolgual
oriolgual / macvim.rb
Created August 9, 2012 13:00
MacVim homebrew formula with clipboard support (useful when use the console mode)
require 'formula'
class Macvim < Formula
homepage 'http://code.google.com/p/macvim/'
url 'https://github.com/b4winckler/macvim/tarball/snapshot-64'
version '7.3-64'
sha1 'c8bf2d758f52a1173112138fefbf4e5ab08015ff'
head 'https://github.com/b4winckler/macvim.git', :branch => 'master'
@oriolgual
oriolgual / hypermodel.rb
Created August 9, 2012 19:28
Readme Driven Development for Hypermodel
module Hypermodel
module ClassMethods
# Public: Adds a new link to the _links section of the representation.
#
# relation - A String or Symbol with the name of the relation. It will
# also be used as a method name to call in the Hypermodel
# class or in the resource (as a second option) to get the href
# if no href provided.
# href - An optional String with the href of the link.
# options - An optional hash to add to the link (like tempalted: true).
@oriolgual
oriolgual / pusher_webhooks_spec.rb
Created January 10, 2013 10:31
Testing Pusher Webhooks with rspec_api_documentation
require 'spec_helper'
require 'rspec_api_documentation/dsl'
resource "Pusher Webhooks" do
let(:user) { Fabricate(:user) }
let(:channel) { YOUR_CHANNEL_NAME }
post '/api/pusher_webhook' do
let(:pusher_key) { YOUR_PUSHER_KEY }
let(:pusher_secret) { YOUR_PUSHER_SECRET }
@oriolgual
oriolgual / elastic_search_indexer.rb
Created March 22, 2013 11:01
Companion gist for my talk about using ElasticSearch with Ruby.
# Public: A module to be mixed in another class with common methods to index
# records in ElasticSearch.
#
# The host object needs to respond to 'indexed_attributes', which will return
# an array of the attributes names to be indexed.
#
# It's also recommended to override the 'save?' method to make sure only
# records that match some specifications are indexed.
#
# The type used for the ElasticSearch index will be extracted from the name of
class SomeController < ApplicationController
helper_method :collection
def index
@collection = Article.all
end
def collection
@decorated_collection ||= ArticlesDecorator.new(@collection)
@oriolgual
oriolgual / mailchimp_full_contact.rb
Created January 24, 2014 10:36
MailChimp + FullContact
# gem install fullcontact pry gibbon
# Setup these fields at mailchimp: FNAME, LNAME, TWITTER, FACEBOOK, GITHUB, LOCATION, GENDER.
# Usage: ruby mailchimp_full_contact.rb MAILCHIMP_LIST_NAME
require "rubygems"
require "fullcontact"
require "pry"
require 'gibbon'
@oriolgual
oriolgual / deploy_beanstalk.sh
Last active June 25, 2018 02:34
Deploy to Beanstalk script taken from Codeship
# Copied from http://www.codeship.io/documentation/continuous-deployment/deployment-to-elastic-beanstalk/
#!/bin/sh
export APP_VERSION=`git rev-parse --short HEAD`
pip install awscli
# clean build artifacts and create the application archive (also ignore any files named .git* in any folder)
git clean -fd
# precompile assets, ...
https://kickass.to/the-troll-hunter-i1740707/
https://kickass.to/the-innkeepers-i1594562/
https://kickass.to/sinister-i1922777/
https://kickass.to/the-evil-dead-i0083907/
https://kickass.to/v-h-s-i2105044/
https://kickass.to/the-descent-i0435625/
https://kickass.to/splinter-i1031280/
https://kickass.to/el-espinazo-del-diablo-i0256009/
https://kickass.to/paranormal-activity-i1179904/
https://kickass.to/the-pact-i2040560/
@oriolgual
oriolgual / env.rb
Created February 13, 2015 14:39
Spinach with rspec 3
ENV['RAILS_ENV'] = 'test'
require './config/environment'
require 'rspec/rails'
require 'capybara-webkit'
require 'vcr'
VCR.configure do |c|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
c.hook_into :webmock
IPFS Barcelona hack day
libP2P
github.com/IPFS/specs
github.com/IPFS/pm
Download and install ipfs
Ipfs init