Skip to content

Instantly share code, notes, and snippets.

Coffee first.

Daniel Negri danielnegri

Coffee first.
View GitHub Profile
danielnegri / Product.rb
Created Apr 7, 2011
Código fonte adaptado do Spree
View Product.rb
class Product < ActiveRecord::Base
# Associations
has_many :order_items
# Attachment
AttachmentSizes = {
:thumb => [64, 64],
:product => [240, 240],
:large => [600, 600]
View _form.html.erb
<%= form_for(@event) do |f| %>
<div class="field">
<%= f.label :show_me_as %><br />
<%= f.radio_button :show_me_as, "available" %>
<%= f.radio_button :show_me_as, "busy" %>
View document.rb
case title
when 'War And Peace'
puts 'Tolstoy'
when 'Romeo And Juliet'
puts 'Shakespeare'
puts "Don't know" end
author = case title
danielnegri / gist:2713891
Created May 16, 2012
Kaplan -
View gist:2713891


Develop using HTML, CSS and Javascript.


For better into development release cycle I'm sending you a Git repository tree. You can follow by log:

danielnegri / factorial.rb
Created Jun 2, 2012 — forked from bitops/factorial.rb
Factorial in Ruby 1.9.2
View factorial.rb
def factorial(n)
danielnegri /
Created Jun 4, 2012
LastFM - Ranking



The attached utf-8 encoded text file contains the favorite musical artists of 1000 users from LastFM. Each line is a list of up to 50 artists, formatted as follows:

  • Radiohead, Pulp, Morrissey, Delays, Stereophonics, Blur, Suede, Sleeper, The La's, Super Furry Animals
  • Band of Horses, Iggy Pop, The Velvet Underground, Radiohead, The Decemberists, Morrissey, Television

Write a program that, using this file as input, produces a list of pairs of artists which appear TOGETHER in at least fifty different lists. For example, in the above sample, Radiohead and Morrissey appear together twice, but every other pair appears only once. Your program should output the pair list to stdout in the same form as the input.

danielnegri /
Created Aug 10, 2012 — forked from stefanbirkner/
Playdeb builds a debian package of the play framework.
# playdeb builds a debian package of the play framework. playdeb downloads
# the playframework by itself. You run it by
# <version> <maintainer>
# Example:
# 1.2.3 "Denny Colt <d.colt@eisner.qcg>"
# The script has been tested with version 1.2.3.
if [ -z $1 ]
danielnegri /
Created Aug 22, 2012 — forked from dgb/
Twitter Bootstrap styles for Devise
$ ->
$('.close').live 'click', (e) ->
$('.devise form div i').each ->
$this = $(this)
text = $this.text()
sibling = $this.prev('label')
a = $("<a>").text("*").attr('title', text)
danielnegri / app.js
Created Sep 21, 2012 — forked from joemaffia/app.js
foursquare OAuth in Titanium
View app.js
* Copyright 2011 Aaron K. Saunders, Clearly Innovative Inc
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <a href=""></a>
View gist:4389145
import dispatch._
import Http._
import scala.xml._
var http = new Http()
var tweets = XML.loadString(http("" as_str))
(tweets \\ "status" \ "text").toList.foreach(x => println(x.text))
You can’t perform that action at this time.