Skip to content

Instantly share code, notes, and snippets.

View tonatiuh's full-sized avatar

Tonatiuh Núñez tonatiuh

View GitHub Profile

Requirements

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
tonatiuh / material_covered_in_classes.md
Last active January 3, 2016 15:29
The material discussed along the Trainees classes (from Wednesday, January 15th to Friday 17th).
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" } }
else
format.json { render json: { message: "Student could not be updated" } }
end
@tonatiuh
tonatiuh / reset_db.sql
Created July 30, 2013 22:06
Reset db on psql
SELECT
'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)
ORDER BY 1;
@tonatiuh
tonatiuh / to_set_signed_up_at_field.rb
Last active December 15, 2015 06:39
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.
User.where(signed_up_at: nil).each do |user|
if user.oauth_token.present? then
user.signed_up_at = user.updated_at
user.save
end
end
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
end
def recreate_bouquet_template_main_images
@tonatiuh
tonatiuh / jquery.ddslick.js
Created December 11, 2012 17:52
Incremental height fix in the ddslick selector jquery plugin bug
// 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 () {
# 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
tonatiuh / index.html.haml
Created October 14, 2012 06:14
Index for the player (on process)
.player
.headerAndLibraryW
%header
%ul
%li
%a{ href:'' } Library
%a{ href:'' } Playlist
%a{ href:'' } Sign out
%form{ }
%input{ type:'text', value:'Search' }
@tonatiuh
tonatiuh / cucumber_error.log
Created September 29, 2012 23:24
Error when running cucumber
@javascript
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: http://api.lvh.me:4433/placements/test (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'