Skip to content

Instantly share code, notes, and snippets.

View oriolgual's full-sized avatar

Oriol Gual oriolgual

View GitHub Profile
@oriolgual
oriolgual / application_controller.rb
Created March 9, 2017 10:07
Example LogRage & Rails configuration
def append_info_to_payload(payload)
super
payload[:remote_ip] = request.remote_ip
payload[:user_id] = current_user.try(:id)
payload[:organization_id] = current_organization.try(:id)
payload[:app] = current_organization.name
payload[:referer] = request.referer.to_s
payload[:request_id] = request.uuid
payload[:user_agent] = request.user_agent
payload[:xhr] = request.xhr? ? 'true' : 'false'
version: '2'
services:
app:
command: bash -c "rm -f tmp/pids/server.pid && bundle install --path /bundle && bundle exec rails s -p 3000 -b '0.0.0.0'"
build:
context: .
args:
rails_env: development
volumes:
- .:/code
@oriolgual
oriolgual / Gemfile
Created May 24, 2016 07:47
Script to mass move repositories from a GitHub user to another
source "https://www.rubygems.org"
ruby '2.2.4'
gem 'byebug'
gem 'capybara'
gem 'selenium-webdriver'
@oriolgual
oriolgual / agilecrm.js
Created December 1, 2015 15:05
AgielCRM unminifed JavaScript client
function agile_setAccount(b, a) {
agile_id.set(b, a);
agile_setEmailFromUrl()
}
function agile_setEmailFromUrl() {
if (window.location.href.search("fwd=cd") !== -1) {
try {
var a = decodeURIComponent(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURI("data").replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
if (a) {
IPFS Barcelona hack day
libP2P
github.com/IPFS/specs
github.com/IPFS/pm
Download and install ipfs
Ipfs init
@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
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 / 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, ...
@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'
class SomeController < ApplicationController
helper_method :collection
def index
@collection = Article.all
end
def collection
@decorated_collection ||= ArticlesDecorator.new(@collection)