Skip to content

Instantly share code, notes, and snippets.

version: '2'
volumes:
postgres-data:
driver: local
gems:
driver: local
services:
db:
@kurenn
kurenn / gist:9205589385479d60d409
Created April 8, 2015 00:49
A simple client for a simple API
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<form action="http://localhost:3000/tasks.json" method="post">
@kurenn
kurenn / Gemfile
Created July 22, 2014 17:46 — forked from pboling/Gemfile
source 'https://rubygems.org'
# Follows the bundler group pattern described here:
# http://iain.nl/getting-the-most-out-of-bundler-groups
# Gemfile.mine in root dir allows locally custom gems.
# NOTE: Doing this will change the Gemfile.lock - commit with care.
eval File.read(File.join(File.dirname(__FILE__), 'Gemfile.mine')) if File.exists? File.join(File.dirname(__FILE__), 'Gemfile.mine')
ruby '1.9.3'
@kurenn
kurenn / gist:4421177
Last active March 29, 2017 21:16
This gist shows how to make a polymorphic association for users in rails which have an specific role, such as Member, Admin...works with devise
##Userable
module Userable
def self.included(base)
base.has_one :user, :as => :userable, :dependent => :destroy, :autosave => true
base.validate :user_must_be_valid
base.alias_method_chain :user, :autobuild
base.extend ClassMethods
base.define_user_accessors
end
@kurenn
kurenn / LenguasIndigenas.json
Created October 20, 2012 23:00
Este es un formato preliminar de como se encuentra actualmente la estrucuta de la API (http://localhost:3000/archives/17.json)
[
[
"ENTIDAD",
"LENGUA",
"TOTAL"
],
[
"Baja California",
"Chol",
@kurenn
kurenn / _form.html.erb
Created March 14, 2012 03:51
Problema con nested resources y un render parcial
<div class="control-group">
<div class="controls">
<%= link_to_add_fields("Agregar producto", f, :requisitions) %>
<%= f.fields_for :requisitions do |builder| %>
<%= render :partial => 'requisition_fields', :locals => {:f => builder } %>
<% end %>
</div>
</div>