Skip to content

Instantly share code, notes, and snippets.

View brianjlandau's full-sized avatar

Brian Landau brianjlandau

  • Walnut Creek, CA
View GitHub Profile
@brianjlandau
brianjlandau / cache_scopes.rb
Created August 6, 2008 20:09
Allows defining named scopes you wish to have cached.
module ActiveRecord
module CacheScopes
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def cache_scopes(scopes)
class_eval "@@finder_caches ||= []"
cattr_accessor :finder_caches
require 'iconv'
module ActiveSupport
module Inflector
extend self
def slugize(words, slug = '-')
sluged = Iconv.iconv('ascii//TRANSLIT//IGNORE', 'utf-8', words).to_s
sluged.gsub!(/&/, 'and')
sluged.gsub!(/[^\w_\-#{Regexp.escape(slug)}]+/i, slug)
/*
DatePicker v4.4 by frequency-decoder.com
- This is a revised version that works with jQuery 1.2.6 as I found the original didn't work properly.
Released under a creative commons Attribution-ShareAlike 2.5 license (http://creativecommons.org/licenses/by-sa/2.5/)
Please credit frequency-decoder in any derivative work - thanks.
You are free:
module Enumerable
def include_any?(obj)
if obj.respond_to?(:include?)
self.any? {|item| obj.include?(item)}
else
false
end
end
end
$(document).ready(function() {
$('.model-listing form.edit-comments').attach(Remote.Form, {
dataType: 'json',
success: function(json, status){
if (json.comment){
var parent_model = $(this.element[0]).parents('.model-listing');
parent_model.find('.model-comment').text(json.comment);
parent_model.find('.model-comment').show();
parent_model.find('form.edit-comments').hide();
parent_model.find('a.edit-comments').show();
function check_all_pass(){
var pass = true;
for (i = 0; i < arguments.length; i += 1){
if (!arguments[i]()){
pass = false;
}
}
return pass;
}
(function($) {
var addMethods = function(source) {
var ancestor = this.superclass && this.superclass.prototype;
var properties = $.keys(source);
if (!$.keys({ toString: true }).length) properties.push("toString", "valueOf");
for (var i = 0, length = properties.length; i < length; i++) {
var property = properties[i], value = source[property];
if (GMap2){
GMap2.prototype.centerAndZoomOnBounds = function(bounds) {
this.setCenter(bounds.getCenter(), this.getBoundsZoomLevel(bounds));
};
}
(function($){
$.mapping = function(places, info_html_template, location_link_template){
$.mapping.location_link_template = $.template(location_link_template);
$.mapping.info_html_template = $.template(info_html_template);
--- old_selenium_rc_server.rb 2009-07-06 14:11:57.000000000 -0400
+++ selenium_rc_server.rb 2009-07-06 14:12:18.000000000 -0400
@@ -30,7 +30,7 @@
def remote_control
return @remote_control if @remote_control
- @remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0", Webrat.configuration.selenium_server_port, 5)
+ @remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0", Webrat.configuration.selenium_server_port, :timeout => 5)
@remote_control.jar_file = jar_path
<div id="map"></div>
<div id="map-side-bar">
<div class="map-location" data-jmapping="{id: 1, point: {lng: -122.2678847, lat: 37.8574888}, category: 'market'}">
<a href="#" class="map-link">Berkeley Bowl</a>
<div class="info-box">
<p>A great place to get all your groceries, especially fresh fruits and vegetables.</p>
</div>
</div>
<div class="map-location" data-jmapping="{id: 2, point: {lng: -122.4391131, lat: 37.7729943}, category: 'restaurant'}">