This file contains hidden or 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
# Load the rails application | |
require File.expand_path('../application', __FILE__) | |
# Initialize the rails application | |
Footnotes::Application.initialize! | |
# Start the websocket server | |
Footnotes::WebSocketServer.new(10081) |
This file contains hidden or 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
CollectionBase = Class.create({ | |
resource: null, | |
resourceName: '', | |
resourceHandler: null, | |
collection: null, | |
initialize: function(resource) { | |
this.collection = {}; | |
this.resource = resource; | |
this.resourceName = resource.prototype.resourceName; |
This file contains hidden or 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
// Custom Rails routing/resource handling for ajax requests.. | |
(function() { | |
var methods = ['get', 'put', 'post', 'delete'], | |
actions = ['index', 'show', 'new', 'create', 'edit', 'update', 'destroy']; | |
function parseUrl(url) { | |
var urlParts = url.match(/^((http[s]?|ftp):\/\/)?(((.+)@)?([^:\/\?#\s]+)(:(\d+))?)?(\/?[^\?#\.]+)?(\.([^\?#]+))?(\?([^#]?))?(#(.*))?$/i) || []; | |
var pathParts = (urlParts[9]) ? urlParts[9].match(/(\/.*)\/+(\w+)$/i) || [] : []; |
This file contains hidden or 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
module Kernel | |
def the(a, b) | |
Exception.new | |
end | |
def roof | |
end | |
def yo! | |
end |
This file contains hidden or 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
module FilterableResource | |
# to test {:filter => {:users => .. } | |
# {:method => 'any', :terms => ['first', 'second'], :fields => 'all'} | |
# {:method => 'any', :terms => 'first second', :fields => 'all'} | |
# {:method => 'any', :terms => 'first', :fields => ['first_name', 'last_name']} | |
# {:method => 'any', :terms => 'first', :fields => 'first_name last_name'} | |
# {:method => 'all', :terms => ['first', 'second'], :fields => 'all'} | |
# {:method => 'all', :terms => 'first second', :fields => 'all'} | |
# {:method => 'all', :terms => 'first', :fields => 'first_name'} | |
# {:method => 'all', :terms => 'first', :fields => ['first_name', 'last_name']} |
This file contains hidden or 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
module FilterableResource | |
def acts_as_filterable(options = {}) | |
cattr_accessor :testing | |
self.testing = 'testing' | |
self.named_scope :filtered_from, lambda { |params| | |
puts('!!![' + self.testing.to_s + ']!!!') | |
nil | |
} | |
end |
NewerOlder