This file contains 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
;;; Twit.el --- interface with twitter.com | |
;; Copyright (c) 2007 Theron Tlax | |
;; (c) 2008 Jonathan Arkell | |
;; Time-stamp: <2007-03-19 18:33:17 thorne> | |
;; Author: thorne <[email protected]>, jonnay <[email protected]> | |
;; Created: 2007.3.16 | |
;; Keywords: comm | |
;; Favorite Poet: E. E. Cummings |
This file contains 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
javascript:(function(){var%20d=document;t=d.createElement(%22style%22);t.appendChild(d.createTextNode(%22*{line-height:2}%22));d.getElementsByTagName(%22head%22)[0].appendChild(t)})(); |
This file contains 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
;; Font zooming with Hyper--/=/0 for Mac | |
;; Inspired by: http://www.emacswiki.org/cgi-bin/wiki/CycleFontSizes | |
(defconst font-zoom-list | |
(mapcar (lambda (n) (format "-*-monaco-*-*-*-*-%d-*-*-*-*-*-*-*" n)) '(6 8 10 13 17 18 24 36 48))) | |
(defconst default-font-zoom-index 3) | |
(defvar font-zoom-index default-font-zoom-index) | |
(defun font-zoom-increase-font-size () |
This file contains 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
--- a/app/controllers/security.rb | |
+++ b/app/controllers/security.rb | |
@@ -10,7 +10,7 @@ module Security | |
# Ensure somebody is logged in. Takes the same options as | |
# +before_filter+. | |
def authenticate(options = {}) | |
- before_filter options.dup { |controller| controller.send(:authenticate) } | |
+ before_filter(options.dup) { |controller| controller.send(:authenticate) } | |
end |
This file contains 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
# Methods to validate dutch social security numbers | |
# (burgerservicenummer) and back account numbers | |
# (bankrekeningnummers) using the "elf proef". | |
module ElfProef | |
def valid_burgerservicenummer?(val) | |
num = val.to_s.scan(/\d/).join.to_i | |
return false if num == 0 | |
digits = ("%09d" % num).split(//).map(&:to_i).reverse | |
return false unless digits.size == 9 |
This file contains 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
namespace :deploy do | |
task :start, :roles => :app do | |
sudo "mongrel_rails cluster::start -C #{mongrel_conf}" | |
end | |
task :stop, :roles => :app do | |
sudo "mongrel_rails cluster::stop -C #{mongrel_conf}" | |
y = { | |
"port" => 3000, "servers" => 2, "pid_file" => "tmp/pids/mongrel.pid" |
This file contains 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
// make sure you call field.fire('hidden:change') when a hidden field changes | |
document.observe('dom:loaded', function() { | |
$$('input[type=hidden]').each(function(e) { | |
var onchange = e.getAttribute('onchange') | |
if (onchange) { | |
if (typeof(onchange) != 'function') { | |
eval("onchange = (function(event){(function(){" + onchange + "}).bind(Event.element(event))()});"); | |
} | |
e.observe('hidden:change', onchange); | |
} |
This file contains 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
// Usage: App.with_resource('user', 567, function(user) { $('report_user_name').value = user.name }) | |
var App = { | |
with_resource: function(name, id, func) { | |
new Ajax.Request("/" + name + "s/" + id + ".json", { | |
method: 'GET', | |
onSuccess: function(transport) { func(transport.responseJSON[name]) } | |
}); | |
} | |
} |
This file contains 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
# Allow query usings scopes and arguments from a hash. Useful for | |
# making index actions. | |
# | |
# Example: | |
# | |
# User.with_scopes(:search => "Fred") | |
# | |
# Where +search+ is a named scope on +User+ which excepts a parameter. | |
module WithScopes | |
# Determine if named scope exists. |
This file contains 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
# Matches posts containing all words in the body. | |
named_scope :search, lambda { |q| | |
if connection.adapter_name == 'MySQL' | |
q = q.split(/\W/).map{|q| "[[:<:]]#{Regexp.escape(q)}[[:>:]]"} | |
{:conditions => [(['posts.body REGEXP ?'] * q.size).join(" AND "), *q]} | |
else | |
raise NotImplementedError | |
end | |
} |
OlderNewer