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!"
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# 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
Shoes.app(:title => "MGang Clock v0.01", :width => 320, :height => 320, :resizable => true) do
background "#234".."#c03", :angle => 45
deg_increment = Math::PI / 4
@imgs = []
@style_over = { :width => 100, :height => 100 }
@style_out = { :width => 20, :height => 20}