Skip to content

Instantly share code, notes, and snippets.

# >---------------------------------------------------------------------------<
#
# _____ _ _ __ ___ _
# | __ \ (_) | \ \ / (_) | |
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| |
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` |
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| |
# |_| \_\__,_|_|_|___/ \/ \/ |_/___\__,_|_| \__,_|
#
# This template was generated by RailsWizard, the amazing and awesome Rails
<%= JST['shared/menu'] %>
<!-- h2 stays for breadcrumbs -->
<h2><a href="#!/shipping_lists">Guías de Ingreso</a> &raquo; <a href="#" class="active">Reportes</a></h2>
<div id="main">
<h3>Guías</h3>
<% if(collection.models.length > 0) { %>
<h3><a href='#!/shipping_lists/new'>Nuevo ingreso</a></h3><ul>
class Integer
def problem?
puts "#trollface"
end
end
1337.problem?
# gem install ruby-mp3info
require 'mp3info'
# Formato: # Pista [espacio] Nombre
# Ejemplo de filtros:
# Antes: 05 - Run Run Run - The Velvet Underground.mp3
# filters = ["- ", " - The Velvet Underground"]
# Después: 05 Run Run Run.mp3
def prepare(name)
@xenda
xenda / facebook_authentication_demo.rb
Created May 10, 2011 21:59
facebook authentication demo
require 'net/http'
require 'uri'
# Here it all starts. Will just run stuff it the user already has the token on DB
def facebook_register
if user_has_secret_token?
@access_token = create_access_token_from_database
run_facebook_stuff(@access_token)
else
redirect_to authorize_url
require 'fbgraph'
unless current_user.has_token?
client = FBGraph::Client.new(:client_id => API_KEY,:secret_id =>SECRET_KEY)
else
client = FBGraph::Client.new(:client_id => API_KEY,:secret_id =>SECRET_KEY ,:token => current_user.facebook_token)
end
client.selection.me.photos.until(Time.now).since(3.days.ago).limit(10).info!
<doctype>
<html>
<head>
<title>Una web</title>
</head>
<body>
<h1>Un título</h1>
<p>Un párrafo</p>
<!-- un comentario -->
<div class="important">Un div</div>
@xenda
xenda / gist:1015005
Created June 8, 2011 18:26 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
class SendList < ActiveRecord::Base
belongs_to :destination, :polymorphic => true
belongs_to :store
has_many :send_list_items
has_many :products, :through => :send_list_items
after_initialize :setup_identifier
def total_items
class Admin::SendListsController < InheritedResources::Base
layout 'admin'
before_filter :authenticate_user!
respond_to :xml, :json
before_filter :setup_send_list, :only => :new
after_filter :update_stock, :only => [:create,:update]
def new
new!{