This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.my-parent-class | |
&.--my-modifier | |
& __my-child-changed-by-modifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
complete = new Teambox.Models.SystemNotification({ | |
title: 'Hola que ases' | |
, message: 'The files were successfuly uploaded.' | |
, status: 'success' | |
, timeout: timeout | |
}); | |
Teambox.Data.system_notifications.add([complete]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% form.inputs :name => "Datos de acceso" do %> | |
<%= form.input :email %> | |
<%= form.input :password %> | |
<%= form.input :password_confirmation %> | |
<% end %> | |
<% @user.build_profile(:contact_email => @user.email) unless @user.profile %> | |
<% form.semantic_fields_for :profile do |profile| %> | |
<% profile.semantic_fields_for :address do |address| %> | |
<%= address.input :address, :as => :select, :label_method => :name %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('babel/register')({ | |
sourceMap: 'inline' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@register.tag | |
def ifmatches(parser, token): | |
lst = token.split_contents() | |
val = lst[1] | |
regex = lst[2] | |
nodelist_true = parser.parse(('else','endifmatches',)) | |
token = parser.next_token() | |
if token.contents == 'else': | |
nodelist_false = parser.parse(('endifmatches',)) | |
parser.delete_first_token() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PROBLEMA: | |
# ¿Cómo hacer que N tipos diferentes de objetos compartan atributos/campos comunes? | |
# Para resolver el problema se me ocurren 3 opciones | |
# A) CON RELACIONES POLIMORFICAS | |
# B) STI | |
# C) TODO EN UNA UNICA TABLA | |
# | |
# ----------------------------------------------------------------------------------------------------------- | |
# A) CON RELACIONES POLIMORFICAS: | |
# NOTA: No estoy seguro, pero creo que esto mismo funcionaria si fuera has_one en lugar de has_many. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://en.wikipedia.org/wiki/Stop_words | |
es_STOPWORDS = [ | |
'de','a','que','en','para', | |
'por','le','la','lo','las','los','el', | |
'una','un','cada' | |
] | |
en_STOPWORDS = [ | |
'I','a','about','an','are', | |
'as','at','by','com','for', | |
'from','how','of', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Esto es un pequeño script que tengo para rellena mi BBDD de desarrollo: | |
# ----------------------------------------------------------------------- | |
require 'faker' | |
namespace :db do | |
desc "Fill database with sample data" | |
task :populate => :environment do | |
Rake::Task['db:reset'].invoke | |
jobs_categories = %w[undergraduate predoctoral postdoctoral associate_prof assistent_prof research_prof technician] | |
address = Address.create!( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Elementos necesarios para hacer un backup periodico de BBDD y archivos con Ruby | |
backup [1] + planeados (cron) con whenever [1] + capistrano (deploy) [3] | |
NOTA: | |
backup tiene diversas estrategias para hacer el backup (scp, ftp, S3,...) | |
Hacer una cuenta de Amazon S3 y probarlo. | |
[1] https://rubygems.org/gems/backup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intervienen en esta función los siguiente modelos | |
1- User | |
2- Profile | |
3- Publication | |
4- ProfilePosition | |
User es donde gestiono la autenticacion. Pero la informacion del miembro la almaceno en Profile. | |
Un Profile tiene muchas publicaciones y una publicacion tiene muchos profiles. Todo a traves de ProfilePosition | |
Estos son los modelos: | |
class User < ActiveRecord::Base |
OlderNewer