Skip to content

Instantly share code, notes, and snippets.


Paco Guzmán pacoguzman

View GitHub Profile
pacoguzman / elixirphoenix.bash
Created Feb 16, 2017 — forked from likethesky/elixirphoenix.bash
Installing Elixir & the Phoenix framework with Homebrew on OS X
View elixirphoenix.bash
$ brew update && brew doctor # Repeat, until you've done *all* the Dr. has ordered!
$ brew install postgresql # You'll need postgres to do this... you may also need to 'initdb' as well. Google it.
$ brew install elixir
$ mix local.hex # Answer y to any Qs
$ createuser -d postgres # create the default 'postgres' user that Chris McCord seems to like -- I don't create mine w/a pw...
# Use the latest Phoenix from here: -- currently this is 1.0.3
# ** Answer y to any Qs **
$ mix archive.install

React "Hello World" Examples

Below are a small collection of React examples to get anyone started using React. They progress from simpler to more complex/full featured.

They will hopefully get you over the initial learning curve of the hard parts of React (JSX, props vs. state, lifecycle events, etc).


You will want to create an index.html file and copy/paste the contents of 1-base.html and then create a scripts.js file and copy/paste the contents of one of the examples into it.

pacoguzman / irpf.rb
Created May 26, 2016 — forked from fxn/irpf.rb
IRPF 2014
View irpf.rb
# Usage:
# ruby irpf.rb tax_base
# Example:
# ruby irpf.rb 65300
# 65300 €, 22722 €, 34.8%
# Where 22,722 € is the IRPF to pay, and 34.8% is the real rate, that is,
View gist:716aa625ca5a11ce47fa

Problem-Solving Games

My daughter and I love playing problem-solving games together. After completing a few I asked for recommendations on Twitter. Here's the list.


View associations_tests.rb
unless ENV['AR_VERSION']
File.write('Gemfile', <<-GEMFILE)
source ''
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
system 'bundle'
View elastic_search_indexer.rb
# 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
View _form.html.erb
<div class="well">
<form class="form">
<div data-behaviour="checkbox-toggle-group">
<input name="blackout[fixed_end]" type="hidden" value="0">
<input class="is-hidden js-checkbox-toggle" id="blackout_fixed_end" name="blackout[fixed_end]" type="checkbox" value="1">
<div class="form-group js-toggle-group">
<label class="form-label" for="blackout_duration">To</label>
<div class="form-fields">
<input class="field-text ten percent" id="blackout_duration" name="blackout[duration]" size="30" type="text">
pacoguzman / app.rb
Created Nov 11, 2012 — forked from dwt/app.rb
Testing jquery-ui sortable with capybara
View app.rb
# Run via: ruby -rubygems app.rb
require 'sinatra'
require 'haml'
disable :logging
get '/' do
title = "Drag'n'drop issue reduction"
haml :index
pacoguzman / http_digest_authentication_test.rb
Created Mar 17, 2012
Test examples of http digest authentication that doesn't works
View http_digest_authentication_test.rb
require 'isolation/abstract_unit'
require 'rack/test'
require 'digest/md5'
require 'action_controller'
require 'rails'
module ApplicationTests
class HttpDigestAuthenticationTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Isolation
include Rack::Test::Methods