Skip to content

Instantly share code, notes, and snippets.

View caffo's full-sized avatar

Rodrigo Franco caffo

View GitHub Profile
@caffo
caffo / consumobot.rb
Created July 21, 2008 23:45
virtua.com.br bandwidth usage reporter (twitter bot)
#!/usr/bin/ruby
# consumobot.rb - virtua.com.br bandwidth usage reporter (twitter bot)
# non-copyright (c) 2008 rodrigo franco <[email protected]>
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@caffo
caffo / fortunebot.rb
Created July 23, 2008 17:27
simple fortune / twitter bot
#!/usr/bin/ruby
# fortunebot.rb - simple fortune / twitter bot
# non-copyright (c) 2008 rodrigo franco <[email protected]>
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
@caffo
caffo / rails_check_syntax.rake
Created July 28, 2008 21:47
sake task for syntax checking a ruby on rails project
# sake rails:check_syntax
# based on this rake task: http://moourl.com/s2dnw
# non-copyright (c) 2008 rodrigo franco <[email protected]>
namespace :rails do
task :load_requirements_and do
require 'erb'
require 'open3'
require 'yaml'
end
$ script/plugin install git://github.com/thoughtbot/hoptoad_notifier.git
Plugin not found: ["git://github.com/thoughtbot/hoptoad_notifier.git"]
$ cd vendor/plugins
$ git clone git://github.com/thoughtbot/hoptoad_notifier.git
Windows could not start because the following file is missing or corrupt:
<windows root>\system32\hal.dll
Please re-install a copy of the above file
# sudo
for x in {0..9} {a..z}; do hanna --gems `gem list | cut -f 1 -d "(" | grep ^$x | tr "\n" " "`; done
#!/usr/bin/env ruby
# The script that give you focus!
# Create a text file that contains sites want to give yourself
# access to only during certain times of day.
#
# The file will look like this:
# 12 news.ycombinator.com
# 11-13,19-21 twitter.com
#
require 'dispatcher'
module ActionController
class Dispatcher
def set_session_domain
ApplicationController.session_options.update(
:session_domain => "#{@request.host.gsub(/^[^.]*/, '')}"
)
end
before_dispatch :set_session_domain
require 'activesupport'
require 'dispatcher'
module ActionController
class Dispatcher
def set_session_domain
ActionController::Base.session_options[:session_domain] = "#{@request.domain}"
end
before_dispatch :set_session_domain
end
end