Skip to content

Instantly share code, notes, and snippets.

View antillas21's full-sized avatar

Antonio Antillon antillas21

  • Mexicali, Mexico
View GitHub Profile
class Contact
delegate :vertical, :to => :campaign, :prefix => true
end
class Campaign
delegate :name, :to => :vertical, :prefix => true
end
contact = Contact.find(1)
camp = Campaign.find(2)
@antillas21
antillas21 / gist:3536739
Created August 30, 2012 18:29
Sample Gemfile
source :rubygems
gem 'rake'
gem 'sinatra', '~> 1.2.3'
gem 'shotgun', '~> 0.9'
gem 'haml', '~> 3.1.4'
# Sass & Compass
gem 'sass', '~> 3.1.12'
gem 'compass', '~> 0.11.6'
@antillas21
antillas21 / gist:3184092
Created July 26, 2012 19:45
OpenGraph Metatags
<head profile="http://www.w3.org/1999/xhtml/vocab">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta property="og:country-name" content="México">
<meta property="og:site_name" content="Cuauhtémoc Moctezuma">
<meta content="Cuauhtémoc Moctezuma premia el hábito de la lectura" about="/es/cuauhtemoc-moctezuma-premia-el-habito-de-la-lectura" property="dc:title">
<link rel="shortcut icon" href="http://www.cuamoc.com/sites/cuamoc.hechoendrupal.com/files/favicon.ico" type="image/vnd.microsoft.icon">
<meta about="/es/cuauhtemoc-moctezuma-premia-el-habito-de-la-lectura" property="sioc:num_replies" content="0" datatype="xsd:integer">
<meta property="og:url" content="http://www.cuamoc.com/es/cuauhtemoc-moctezuma-premia-el-habito-de-la-lectura">
<meta property="og:image" content="http://www.cuamoc.com/sites/cuamoc.hechoendrupal.com/files/styles/thumbnail/public/blog/image/concurso_lectura.jpg">
<link rel="canonical" href="/es/cuauhtemoc-moctezuma-premia-el-habito-de-la-lectura">
@antillas21
antillas21 / Gemfile
Created July 23, 2012 17:45
elasticsearch - playing around
# ... gems
# para este demo, al guardar un registro, vía geocoder obtenía su geolocalizaicón
gem 'geocoder'
# Ruby API & DSL, with ActiveRecord/ActiveModel integration.
gem 'tire'
# elasticsearch requiere que el modelo a indexar soporte paginación,
# lo podemos lograr con will_paginate o kaminari (your choice)
@antillas21
antillas21 / gist:3132604
Created July 17, 2012 22:35
ctsteps.auth cucumber
~/Documents/Apps/TangoSource/ctsteps-authorization-server [testing]$ rake cucumber
/Users/aantillon/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -S bundle exec cucumber --profile default
Using the default profile...
Feature: Change password
Background: # features/change_password.feature:3
Given a client # features/step_definitions/homepage_backrgound_steps.rb:2
And I have an account # features/step_definitions/forgot_password_steps.rb:1
execution expired (Timeout::Error)
/Users/aantillon/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/smtp.rb:540:in `initialize'
@antillas21
antillas21 / manage.py.sh
Created July 12, 2012 18:14
Result from => ./manage.py syncdb --noinput
vagrant@lucid64:/vagrant$ ./manage.py syncdb --noinput
Traceback (most recent call last):
File "./manage.py", line 14, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
@antillas21
antillas21 / console.sh
Created July 11, 2012 18:15
Gem Bundle
~/Documents/Apps/TangoSource/ctsteps-authorization-server [master*]$ bundle
Using rake (0.8.7)
Using multi_json (1.3.6)
Using activesupport (3.1.0)
Using bcrypt-ruby (3.0.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0)
Using erubis (2.7.0)
Using rack (1.3.6)
@antillas21
antillas21 / bundle-install
Created July 11, 2012 00:30
Bundle error
~/Documents/Apps/TangoSource/ctsteps-authorization-server [master]$ bundle install
Fetching gem metadata from http://gems.onterraresearch.net/.
Fetching full source index from http://gems.onterraresearch.net/
Fetching gem metadata from http://rubygems.org/........
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/Users/aantillon/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:650:in `load': uninitialized constant Psych::Object (NameError)
from /Users/aantillon/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:650:in `_load'
from /Users/aantillon/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.4/lib/bundler/fetcher.rb:57:in `load'
from /Users/aantillon/.rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.1.4/lib/bundler/fetcher.rb:57:in `fetch_spec'
@antillas21
antillas21 / Gemfile
Created July 6, 2012 07:38
CKEditor dependencies
source 'https://rubygems.org'
# long list of gems
gem 'rails_admin' # to handle auth and adding content
gem "ckeditor", "3.7.1"
# ckeditor gem is the one responsible for making the WYSIWYG editor available
# even more gems
@antillas21
antillas21 / rough_draft.md
Created July 4, 2012 17:01
Tweet capturado con TweetStream

##Flujo

  • Abrir un cliente al Streaming API de twitter via la gema TweetStream
  • Este cliente debe estar siempre funcionando y proveer un comportamiento cuando haya necesidad de reconnectarse (por problemas en twitter y diversos) y en caso de error (por las mismas causas) # Leer documentacion de la gema
  • El cliente debe enviar todos los tweets capturados en base a un query='on @dimensions, @dimensions' a un Array o a un queue.
  • A través de un background_job, procesar el queue, leyendo de cada tweet capturado, el atributo :expanded_url (provisionando que puede ser nulo o empty)
  • El background_job debe hacer una búsqueda en los feed_entries con ese valor capturado. Si encuentra un match, entonces += 1 a su tweet_count.