Skip to content

Instantly share code, notes, and snippets.

View caffo's full-sized avatar

Rodrigo Franco caffo

View GitHub Profile
module ActionControllerExtensions
def self.included(base)
base::Dispatcher.send :include, DispatcherExtensions
end
module DispatcherExtensions
def self.included(base)
base.send :before_dispatch, :set_session_domain
end
module ActionControllerExtensions
def self.included(base)
base::Dispatcher.send :include, DispatcherExtensions
end
module DispatcherExtensions
def self.included(base)
base.send :before_dispatch, :set_session_domain
end
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
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
#!/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
#
# sudo
for x in {0..9} {a..z}; do hanna --gems `gem list | cut -f 1 -d "(" | grep ^$x | tr "\n" " "`; done
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
$ cd vendor/plugins
$ git clone git://github.com/thoughtbot/hoptoad_notifier.git
$ script/plugin install git://github.com/thoughtbot/hoptoad_notifier.git
Plugin not found: ["git://github.com/thoughtbot/hoptoad_notifier.git"]
@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