Skip to content

Instantly share code, notes, and snippets.

View Sutto's full-sized avatar

Darcy Laycock Sutto

View GitHub Profile
@Sutto
Sutto / gist:29
Created July 20, 2008 20:38
undefined
We couldn’t find that file to show.
Guildhouse System Edited by spgm Member of Trinitycore for 3.3.3 Rev 8670
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -1,3 +1,4 @@
+add_subdirectory(GuildHouse)
add_subdirectory(updates)
add_subdirectory(scripts)
add_subdirectory(base)
#!/usr/bin/env ruby
## Will add a new rails host for the specified directory.
## Usage: sudo board-train directory domain
if ARGV[0].nil? || ARGV[1].nil?
puts "Usage: #{__FILE__} directory domain"
exit
end
@Sutto
Sutto / gist:1817
Created July 23, 2008 17:15
A simple script to add a passenger host - added before the passenger prefpane was available
#!/usr/bin/env ruby
## Will add a new rails host for the specified directory.
## Usage: sudo board-train directory domain
if ARGV[0].nil? || ARGV[1].nil?
puts "Usage: #{__FILE__} directory domain"
exit
end
class Whatever < ActiveRecord::Base
class << self
def find_with_awesome(*args)
opts = args.extract_options!
if opts.has_key?(:awesome)
awesome = opts.delete(:awesome)
# process something here....
end
find_without_awesome(*(args << opts))
<VirtualHost *:80>
# Redirect WWW-requests to no-wwww
ServerName www.domain.com
DocumentRoot /var/www/
RedirectMatch permanent (.*) http://whygosolo.com$1
</VirtualHost>
<VirtualHost *:80>
ServerName domain.com
DocumentRoot /path/to/app/current/public
class Hash
def recursively_stringify_keys
result = {}
self.each do |k,v|
result[k.to_s] = (v.is_a?(Hash) ? v.recursively_stringify_keys : v)
end
return result
end
end
# jsminlib.rb 2007-12-29
# Author: David Troy <dave@popvox.com>
# Based directly on jsmin.rb by Uladzislau Latynski
# Converted to use the JSMin class and the minimize method rathert han
# stdin/stdout
#
# This work is a translation from C to Ruby of jsmin.c published by
# Douglas Crockford. Permission is hereby granted to use the Ruby
# version under the same conditions as the jsmin.c on which it is
# based.
class DownloadsController < ApplicationController
before_filter :can_create?, :only => [:new, :create]
before_filter :can_edit?, :only => [:edit, :update, :destroy]
resources_controller_for :downloads
helper_method :can_create?, :can_edit?
def can_create?
return !!(current_user && current_user.superuser?)
end
# And then, our mixin. Note that it makes a few assumptions
module ControllerMixin
def self.included(parent)
parent.class_eval do
include InstanceMethods
extend ClassMethods
end
end