This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Drop.io Upload Tool for GNOME | |
# Copyright (C) 2008 Ryan Paul (SegPhault) | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 2 of the License, or | |
# (at your option) any later version. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/:id' do | |
@vent = Vent.get(params[:id]) | |
erb :show | |
end | |
# show post | |
get '/:id.xml' do | |
@vent = Vent.get(params[:id]) | |
builder :show | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "dnssd" | |
require "set" | |
require "socket" | |
require "webrick" | |
module AliveJour | |
include Socket::Constants | |
Paste = Struct.new(:name, :host, :port) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) Point *.example.com in your DNS setup to your server. | |
# | |
# 2) Setup an Apache vhost to catch the star pointer: | |
# | |
# <VirtualHost *:80> | |
# ServerName *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain | |
class ApplicationController < ActionController::Base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "sinatra" | |
require "render" | |
Sinatra::EventContext.send :include, Render | |
SVN_REPO_PATH = "/home/tiago/projects/repo/trunk" | |
get "/" do | |
render :cache => true, :expire => 60 do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
open('http://feeds.feedburner.com/Rubyconf2008-Confreaks') do |f| | |
Hpricot.XML(f).search("link").each do |link| | |
puts "Downloading #{link.inner_text}" | |
`wget -c #{link.inner_text}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
before_filter :set_views_paths_for_layout | |
# Add new paths to templates paths. | |
def set_views_paths_for_layout | |
paths = [] | |
... | |
paths << create_a_new_path("#{RAILS_ROOT}/app/views/shared") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on: | |
# http://github.com/bmizerany/heroku-sinatra-app | |
# http://www.sinatrarb.com/book.html#heroku | |
# trial-and-error | |
# | |
# I tried using Blake's sample code from github, | |
# but for some reason my Heroku.com app was running in | |
# a directory called /mnt. This did not correspond to the | |
# name of my app. The code below is more explicit when it | |
# comes to the name of the app file. That is the only difference. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'memcache' | |
memcache_options = { | |
:namespace => 'agp:test:key', | |
:multithread => true | |
} | |
memcached_servers = [ ENV['MEMCACHED_LOCATION'] || '0.0.0.0:12211'] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# On CRON: | |
# 00,15,30,45 * * * * /home/user/project/reload.sh >> /home/user/log/release_web.log 2>&1 | |
echo "Rebuilding" > /home/user/project/current/public/index.html | |
# Update the code | |
svn update /home/user/project/current | |
# Run migrations | |
cd /home/user/project/current | |
rake RAILS_ENV=$RAILS_ENV db:migrate; | |
# Restart memcached. |