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
# OBSOLETE: See http://in.finitu.de/2009/04/25/use_route-param-for-rails-url-helper | |
module PathExpander | |
def self.included(base) | |
base.send :include, InstanceMethods | |
base.helper_method :expand_url, :expand_path | |
end | |
module InstanceMethods | |
def expand_url(path, options = {}) |
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
# Based on http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1812-default_scope-cant-take-procs | |
ActiveRecord::Base.class_eval do | |
class << self | |
private | |
def find_last(options) | |
order = options[:order] | |
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
// FieldNotes | |
// ========== | |
// Author: Peter Wagenet | |
// Description: Provides descriptions in text fields, removing them when the field is | |
// active and when the form is submitted. | |
// | |
// Sample Usage: | |
// <script type="text/javascript" charset="utf-8"> | |
// document.observe("dom:loaded", function(){ | |
// new FieldNotes('id_of_form', { |
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
# Show Growl notifications from both autotest and autospec | |
# Author: Peter Wagenet (http://in.finitu.de) | |
# URL: http://gist.github.com/101692 | |
module Autotest::Growl | |
def self.growl title, msg, img, pri=0, sticky="" | |
command = "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}" | |
# puts command | |
system command | |
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
require 'proxy_block' | |
module WithoutTimestamps | |
def self.included(base) | |
base.send :extend, ClassMethods | |
base.send :include, InstanceMethods | |
class << base; proxy_block :without_timestamps; end | |
base.send :proxy_block, :without_timestamps | |
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
# Tasks to use with test_benchmark when it is installed as a gem | |
# Does not require you to install as a plugin or frozen gem or otherwise modify your project | |
# Author: Peter Wagenet (http://in.finitu.de) | |
# URL: http://gist.github.com/112225 | |
begin | |
require 'rubygems' | |
gem 'timocratic-test_benchmark' | |
def find_file(fn) |
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
// ========================================================================== | |
// Project: SproutCore - JavaScript Application Framework | |
// Copyright: ©2006-2009 Apple Inc. and contributors. | |
// License: Licened under MIT license (see license.js) | |
// ========================================================================== | |
/*globals module ok equals same test MyApp */ | |
var store, storeKey, json, hash, hash2; | |
module("SC.Store#createRecord", { |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>Text Editor</title> | |
<meta name="generator" content="TextMate http://macromates.com/"> | |
<meta name="author" content="Peter Wagenet"> | |
<!-- Date: 2010-05-12 --> |
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
MyApp.MyModel.mixin({ | |
resourcePathFor: function(action, storeKey, item) { | |
var id, path; | |
id = storeKey ? MyApp.store.idFor(storeKey) : null; | |
switch(action) { | |
case 'fetch': | |
case 'create': | |
path = 'items'; |
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
require 'uuid' | |
module ActiveRecord | |
module UUID | |
def self.included(base) | |
base.send :extend, ClassMethods | |
base.send :include, InstanceMethods | |
class << base | |
alias_method :uuid_exists?, :exists? |
OlderNewer