Public Gists by ismasan

Gravatar
Sun Nov 08 08:16:51 -0800 2009
1
2
3
/* Jquery plugin for quick Comet long polling connections
Nothing special about this (just a recursive Ajax call).
The key is having the server hold connections open until there's data to push back to the client.
Gravatar
Sun Oct 18 11:57:36 -0700 2009
1
2
3
# Create a unique, non-numeric ID for your ActiveRecord objects
 
require 'uuid' # http://github.com/assaf/uuid/
Gravatar
Wed Oct 14 11:54:34 -0700 2009
1
2
3
# USAGE ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# require 'rack/versioner'
 
Gravatar
Fri Oct 02 03:30:46 -0700 2009
1
2
3
# Put this in an initializer (config/initializers/common_scopes.rb) or library file.
#
module CommonScopes
Gravatar
Thu Sep 10 04:01:47 -0700 2009
1
2
3
# This module allows you to prepend a version prefix to your Sinatra URLs
# Example:
#
Gravatar
Tue Jul 21 08:47:58 -0700 2009
1
2
3
# Free RESTful interface for your Ruby objects with Rackable
# http://github.com/madx/rackable/tree/master
#
Gravatar
Tue Jun 23 02:27:50 -0700 2009
1
2
3
# Common pattern for including instance and class level modules
module SomeModule
  def self.included(my_class)
Gravatar
Mon Jun 15 07:05:41 -0700 2009
1
2
3
class ManyLevels
  extend HashMapper
  map from('/name'), to('/tag_attributes/name')
Gravatar
Tue May 19 09:14:31 -0700 2009
1
2
3
# Cache Headers
# Middleware for configuring HTTP cache policy headers in Rack based web applications.
# Apply cache headers to HTTP responses corresponding to requests that match defined
Gravatar
Wed Feb 25 13:35:06 -0800 2009
1
2
3
# Put this in an initializer (config/initializers/common_scopes.rb) or library file.
#
module CommonScopes
Gravatar
Wed Feb 25 13:09:25 -0800 2009
1
2
3
class Post < ActiveRecord::Base
  belongs_to :user
  belongs_to :shop
Gravatar
Wed Feb 11 03:54:26 -0800 2009
1
2
3
module Spec
  module Rails
    module Matchers
Gravatar
Fri Dec 12 03:57:58 -0800 2008
1
2
3
# this facades a model with all helpers and controller data available
#
class RssModel
Gravatar
Mon Dec 08 07:53:32 -0800 2008
1
2
3
# Easy ActiveRecord sorting with named_scopes and resources_controller
# this goes in your initializers, lib directory or as a plugin
module ClassMethods
Gravatar
Mon Dec 08 02:28:05 -0800 2008
1
2
3
# we want /posts, /posts/published, /posts/drafts, etc. without too much duplication
 
# model
Gravatar
Tue Nov 25 03:04:47 -0800 2008
1
2
3
module BlahPlugin
  VERSION = '1.0.0'
  
Gravatar
Tue Nov 04 13:55:58 -0800 2008
1
2
3
# Create ActiveRecord schemas on the fly for AR extensions testing
#
ActiveRecord::Base.establish_connection(