Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/ruby -W0
=begin
Quick and dirty way to tweet the currently active
Safari tab (title + shortened URL). Hashtags get
passed in as parameters (the hash sign gets added
by the script, so don't do it yourself).
Adapt to your needs!
=end
# The simplest thing that could possibly work.
class Attachment < ActiveRecord::Base
before_create :store_metadata
after_create :store_file
# Virtual attribute that stores the uploaded tempfile
attr_accessor :uploaded_file
private
Let's make a list of Sinatra-based apps!
Apps:
- http://github.com/cschneid/irclogger "Sinatra based irclogger.com"
- http://github.com/rtomayko/wink "minimalist blogging engine"
- http://github.com/foca/integrity "The easy and fun Continuous Integration server"
- http://github.com/sr/git-wiki "git-powered wiki"
- http://github.com/entp/seinfeld "Seinfeld-inspired productivity calendar to track your public github commits."
- http://github.com/karmi/marley "Marley, the blog engine without <textareas>."
- http://github.com/ichverstehe/gaze "Serve up your Markdown files with this tiny Sinatra app!"
# iniziamo creando una nuova applicazione Rails
rails silly_blog
cd silly_blog
# portiamola sotto version control con Git
git init
git add .
git commit -a -m "first commit"
# siamo nel "master" branch
# Generations
%w(
rubygems dm-core
haml dm-aggregates
sinatra dm-is-paginated
uv dm-is-slugged
ostruct dm-tags
).each {|n| require(n)}
configure do