Skip to content

Instantly share code, notes, and snippets.

View emilioeduardob's full-sized avatar
🏠
Working from 🇵🇾

Emilio Blanco emilioeduardob

🏠
Working from 🇵🇾
View GitHub Profile
@emilioeduardob
emilioeduardob / .vimrc.after
Created September 12, 2014 15:15
My custom projections
let g:rails_projections = {
\ "config/projections.json": {
\ "command": "projections"
\ },
\ "app/services/*.rb": {
\ "command": "service",
\ "affinity": "model",
\ "test": "spec/services/%s_spec.rb",
\ "related": "app/models/%s.rb",
\ "template": "class %S\n\n def run\n end\nend"
@emilioeduardob
emilioeduardob / PushNotifications.js
Last active August 29, 2015 14:17
AngularJS Service for phonegap PushPlugin
angular.module("utils")
.factory("PushNotifications", function($cordovaPush, $rootScope){
var msgCallback;
var regCallback;
var errorCallback;
var gcmSenderId;
var service = {
setGcmSenderId: setGcmSenderId,
@emilioeduardob
emilioeduardob / gitproxy-socat
Created October 9, 2012 13:59 — forked from sit/gitproxy-socat
A simple wrapper around socat to use as a git proxy command
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny
/**
* WkHtmlToPdf table splitting hack.
*
* Script to automatically split multiple-pages-spanning HTML tables for PDF
* generation using webkit.
*
* To use, you must adjust pdfPage object's contents to reflect your PDF's
* page format.
* The tables you want to be automatically splitted when the page ends must
* have a class name of "splitForPrint" (can be changed).
@emilioeduardob
emilioeduardob / snippets.cson
Created April 20, 2016 18:17
My rails snippets for Atom
'.source.ruby':
'Service':
'prefix': 'service'
'body': """
class ${1:ServiceName}
attr_reader :${2:param}
def initialize(${2:param})
@${2:param} = ${2:param}
end
@emilioeduardob
emilioeduardob / mailman_capistrano.rb
Last active September 29, 2016 11:29
Capistrano recipe for Mailman
set :mailman_cmd, -> { "#{fetch(:bundle_cmd, 'bundle')} exec mailman" }
set :mailman_config, -> { "#{current_path}/config/mailman.rb" }
set :mailman_role, -> { :app }
set :mailman_pid, -> { "#{current_path}/tmp/pids/mailman.pid" }
namespace :mailman do
desc 'Stop mailman'
task :stop do
on roles(:app) do
execute "if [ -d #{current_path} ] && [ -f #{fetch(:mailman_pid)} ] && kill -0 `cat #{fetch(:mailman_pid)}` > /dev/null 2>&1; then cd #{current_path} && rm #{fetch(:mailman_pid)} ; else echo 'Mailman is not running'; fi"
socat -d TCP-LISTEN:2376,range=127.0.0.1/32,reuseaddr,fork UNIX:/var/run/docker.sock
curl localhost:2376/version
require "rails_helper"
describe "Select 2", type: :feature do
def create_invoice_with_categories
Category.where(name: "Cat #1", description: "Desc 1").first_or_create!
cat = Category.where(name: "Cat #2", description: "Desc 2").first_or_create!
Invoice.first_or_create!(category: cat)
end
def create_invoice_with_city
@emilioeduardob
emilioeduardob / ruby.json
Created September 25, 2017 13:32
ActiveAdmin Snippets for VScode
{
"ActiveAdmin Form": {
"prefix": "admin_form",
"body": [
"form do |f|",
"\tf.inputs \"Details\" do",
"\t\tf.input :$1",
"\tend",
"\tf.actions",
"end"
@emilioeduardob
emilioeduardob / upgrade-postgres-9.3-to-9.5.md
Last active February 17, 2018 17:09 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

export LC_CTYPE=en_US.UTF-8; export LC_ALL=en_US.UTF-8
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main