Skip to content

Instantly share code, notes, and snippets.


Tonatiuh Núñez tonatiuh

View GitHub Profile


What we're going to show the client (Proposal):

  • App's use cases
  • Wireframes of the UI
  • Technical diagrams

What we're expecting to find:

tonatiuh /
Last active Jan 3, 2016
The material discussed along the Trainees classes (from Wednesday, January 15th to Friday 17th).
View after_update.rb
class EnglishStudentsController < ApplicationController
def update
@english_student = User.find(params[:id])
respond_to do |format|
if @english_student.update_attributes(english_student_params)
format.json { render json: { message: "Student updated successfuly" } }
format.json { render json: { message: "Student could not be updated" } }
tonatiuh / reset_db.sql
Created Jul 30, 2013
Reset db on psql
View reset_db.sql
'DROP TABLE '||c.relname ||' CASCADE;'
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_roles r ON r.oid = c.relowner
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','')
AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
AND pg_catalog.pg_table_is_visible(c.oid)
tonatiuh / to_set_signed_up_at_field.rb
Last active Dec 15, 2015
To set the 'update_at' (the last time the user signed in) field value to the 'signed_up_at' for the users who have that field as nil.
View to_set_signed_up_at_field.rb
User.where(signed_up_at: nil).each do |user|
if user.oauth_token.present? then
user.signed_up_at = user.updated_at
View generate_bouquet_template_images.rake
require 'delayed_job'
namespace :content do
desc "Generates the bouquet template images"
task :generate_bouquet_template_images => :environment do
puts ">>>>>>>>>>>>>>>>>>>>>> Creating (or recreating) the bouquet template image versions"
handle_asynchronously :recreate_bouquet_template_main_images
def recreate_bouquet_template_main_images
tonatiuh / jquery.ddslick.js
Created Dec 11, 2012
Incremental height fix in the ddslick selector jquery plugin bug
View jquery.ddslick.js
// It was happening when the options weren't having description, so the plugin gets inside this function and for some reason looks like the l0Height variable gets incremented (when it shouldn't).
// The fix for me was to put the line-height as constant with the:
// var lOHeight = '35px';
// line.
//Private: Adjust appearence for drop down options (move title to middle), when no desripction
function adjustOptionsHeight(obj) {
obj.find('.dd-option').each(function () {
View schema.rb
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
tonatiuh / index.html.haml
Created Oct 14, 2012
Index for the player (on process)
View index.html.haml
%a{ href:'' } Library
%a{ href:'' } Playlist
%a{ href:'' } Sign out
%form{ }
%input{ type:'text', value:'Search' }
tonatiuh / cucumber_error.log
Created Sep 29, 2012
Error when running cucumber
View cucumber_error.log
Scenario: Returning to a form placement # features/collection.feature:12
When a contact returns to a form placement completed previously # features/step_definitions/engine_steps.rb:132
Unable to load URL: (Capybara::Driver::Webkit::WebkitInvalidResponseError)
./features/step_definitions/engine_steps.rb:29:in `/^a contact visits a page with an? (\w+) placement$/'
features/collection.feature:13:in `When a contact returns to a form placement completed previously'