Skip to content

Instantly share code, notes, and snippets.

run 'gem sources -a http://gemcutter.org'
git :init
file '.gitignore', <<TXT
log/*.log
tmp/**/*
db/*.sqlite3
.DT_Store
TXT
run 'gem sources -a http://gemcutter.org'
git :init
file '.gitignore', <<TXT
log/*.log
tmp/**/*
db/*.sqlite3
.DT_Store
TXT
dns - http://freedns.ws
google apps - http://google.com/a
yola, pra criar o site - http://www.yola.com/
logonerds, logos por $50 - http://www.logonerds.com/
wuffo, forms builder - http://wufoo.com/
analytics, pra monitorar - http://www.google.com/analytics/
blog (tumblr)
twitter
adwords
@elomar
elomar / bissexto.asm
Created October 8, 2009 23:48
Lista de Exercícios de Assembly
# Considerando que o ano está em $7
main: # Divisíveis por 400 são bissextos
addi $8, $0, 400
div $7, $8
mfhi $9
beq $9, 0, bissexto
# Divisíveis por 100 e não por 400 não são bissextos
addi $8, $0, 100
#include<stdio.h>
#include<string.h>
int subpadrao(char romano[], int decimal, int base, char letra_1, char letra_5, char letra_10) {
while(decimal >= 10 * base) {
strncat(romano, &letra_10, 1);
decimal -= 10 * base;
}
if(decimal >= 9 * base) {
strncat(romano, &letra_1, 1);
Comment.blueprint do
author_name "Test name"
author_email "unknown@maisweb.org"
post
end
Comment.blueprint(:approved) do
state :approved
end
post = Post.make
post.new_record? # false
post = Post.make_unsaved
post.new_record? # true
post.plan
# { :title => "Lorem ipsum", :body => "Lorem ipsum dolor sit amet", ... }
post = Post.make(:title => "Machinist FTW")
Post.blueprint do
title "Hello world"
text "<p>Hello there</p>"*3
published_on Date.today
author { User.make }
end
Comment.blueprint do
author_name "Test name"
author_email "unknown@maisweb.org"
require 'faker'
Sham.name { Faker::Name.name }
Sham.email { Faker::Internet.email }
Sham.title { Faker::Lorem.sentence }
Sham.body { Faker::Lorem.paragraph }
User.blueprint do
name
email
require File.dirname(__FILE__) + '/../spec_helper'
describe Event do
it { should belong_to(:organizer, :class_name => "User") }
it { should have_many(:registrations) }
it { should have_many(:users, :through => :registrations) }
it { should have_many(:promocodes)}
it { should validate_presence_of(:title, :location, :description, :start_at, :finish_at)}
it { should validate_numericality_of(:price, :allow_nil => true)}