Skip to content

Instantly share code, notes, and snippets.

View fujin's full-sized avatar

AJ Christensen fujin

  • Rotorua, New Zealand
View GitHub Profile
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do |r|
# This deferred route allows permalinks to be handled, without a separate rack handler
defer_to do |request, path_match|
unless (article = Article.find_by_permalink(request.uri.to_s.chomp("/"))).nil?
{:controller => "articles", :action => "show", :id => article.id}
end
end
# Admin namespace
@fujin
fujin / router.rb
Created September 22, 2008 04:01 — forked from carllerche/router.rb
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do |r|
# This deferred route allows permalinks to be handled, without a separate rack handler
match("/:permalink").defer_to do |request, params|
unless (article = Article.find_by_permalink(params[:permalink)).nil?
{:controller => "articles", :action => "show", :id => article.id}
end
end
# Admin namespace
~ Started request handling: Mon Sep 22 17:47:00 +1200 2008
~ Params: {"action"=>"index", "controller"=>"admin/dashboard"}
~ Named route admin_dashboard could not be generated with {} - (Merb::Router::GenerationError)
/home/aj/www/junglist/gems/gems/merb-core-0.9.8/lib/merb-core/dispatch/router/route.rb:85:in `generate'
/home/aj/www/junglist/gems/gems/merb-core-0.9.8/lib/merb-core/controller/abstract_controller.rb:442:in `url'
/home/aj/www/junglist/app/helpers/global_helpers.rb:106:in `menu_items'
/home/aj/www/junglist/app/helpers/global_helpers.rb:27:in `render_menu'
/home/aj/www/junglist/app/views/layout/admin.html.erb:12:in `__home__aj__www__junglist__app__views__layout__admin_html_erb'
/home/aj/www/junglist/gems/gems/merb-core-0.9.8/lib/merb-core/controller/mixins/render.rb:130:in `send'
/home/aj/www/junglist/gems/gems/merb-core-0.9.8/lib/merb-core/controller/mixins/render.rb:130:in `render'
Processing RestNodesController#update (for 123.100.71.5 at 2008-09-24 10:17:41) [PUT]
Session ID: f36b628fb5cced0177f18421a933c62d
Parameters: {"node"=>{"attribs"=>{"attrib"=>[{"name"=>"apache_keepalive", "values"=>{"value"=>"On"}}, {"name"=>"apache_keepaliverequests", "values"=>{"value"=>"100"}}, {"name"=>"apache_keepalivetimeout
", "values"=>{"value"=>"5"}}, {"name"=>"apache_listen_ports", "values"=>{"value"=>["80", "443"]}}, {"name"=>"apache_prefork_maxclients", "values"=>{"value"=>"150"}}, {"name"=>"apache_prefork_maxrequestsp
erchild", "values"=>{"value"=>"0"}}, {"name"=>"apache_prefork_maxspareservers", "values"=>{"value"=>"10"}}, {"name"=>"apache_prefork_minspareservers", "values"=>{"value"=>"5"}}, {"name"=>"apache_prefork_
startservers", "values"=>{"value"=>"5"}}, {"name"=>"apache_timeout", "values"=>{"value"=>"300"}}, {"name"=>"apache_worker_maxclients", "values"=>{"value"=>"150"}}, {"name"=>"apache_worker_maxrequestsperc
hild", "values"=>{"value"=>"0"}}, {"name"=>"apache_worker_maxsparethr
# iclassify
total_memory = attrib?("memorysize")
if total_memory
if total_memory =~ /MB$/
total_memory.gsub!(/ MB/, '')
total_memory = total_memory.to_f
else
total_memory.gsub!(/ GB/, '')
total_memory = total_memory.to_f * 1024
end
#!/usr/bin/env ruby
# Config
# ------
# hooks.mailinglist
# This is the list that all pushes will go to; leave it blank to not send
# emails for every ref update.
# hooks.emailprefix
# All emails have their subjects prefixed with this prefix, or "[SCM]"
# if emailprefix is unset, to aid filtering
@fujin
fujin / gist:15165
Created October 6, 2008 22:48 — forked from loe/gist:15164
define monit_file($ensure = 'absent') {
include monit
case $ensure {
'present': {
file {
"/etc/monit.d/${name}.run":
owner => "root", group => "root", mode => "0644",
replace => true,
source => "puppet:///monit/${name}.run",
notify => Service["monit"];
Merb.logger.info("Loaded DEVELOPMENT Environment...")
Merb::Config.use { |c|
c[:exception_details] = true
c[:reload_templates] = true
c[:reload_classes] = true
c[:reload_time] = 0.5
c[:log_auto_flush ] = true
c[:ignore_tampered_cookies] = true
c[:log_level] = :debug
}
server {
listen 80;
client_max_body_size 50M;
server_name junglist.gen.nz;
root /home/aj/www/junglist/public/;
access_log /var/log/nginx/junglist.access.log;
aj@junglist ~/git$ thor merb:edge:core --install
thor repository exists, updating or branching instead of cloning...
Pulling from git://github.com/wycats/thor.git
error: pathspec 'master' did not match any file(s) known to git.
fatal: bad revision 'HEAD'
fatal: Needed a single revision
/home/aj/git/merb.thor:203:in `install_gem_from_src': No Rakefile found for thor (Gem::InstallError)
from /home/aj/git/merb.thor:959:in `install_from_src'
from /home/aj/git/merb.thor:817:in `refresh_from_source'