Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
| module RPH | |
| module LinkConverter | |
| def self.included(klass) | |
| klass.extend ClassMethods | |
| end | |
| module ClassMethods | |
| def convert_links_for(*columns) | |
| methods = [] |
| // Why is this not working in IE!?!? | |
| // (using jQuery 1.4.2 and Rails 2.3.5) | |
| // The issue is that it either: 1) posts as a regular form, ignoring the ajax | |
| // or 2) asks me to download a file | |
| // Yes, I've tried config.action_controller.use_accept_header = false | |
| // in environment.rb and that has no effect on the outcome | |
| // force accept headers |
| (function($) { | |
| $.scroller = { | |
| // default settings | |
| settings: { | |
| url: null, | |
| reversed: true, | |
| triggerAt: 250, | |
| page: 2, | |
| container: $(document), | |
| update: '#scroller' |
| // A bi-directional infinite scrolling jQuery plugin | |
| // | |
| // Usage Example: | |
| // $(window).infiniteScroll({ url: window.location.href }) | |
| (function($) { | |
| $.scroller = { | |
| // default settings | |
| settings: { | |
| url: null, |
| development: | |
| subdomain: development-subdomain | |
| api_key: XXX | |
| site_key: XXX | |
| production: | |
| subdomain: production-subdomain | |
| api_key: XXX | |
| site_key: XXX |
| # Playing around with CoffeeScript... | |
| ##################################################################################### | |
| # Validator needs to inherit from Module class so we can support mixins | |
| class Module | |
| @include: (obj) -> | |
| for key, value of obj | |
| @::[key] = value | |
| # ----------------------------------------------------------------------------------- |
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
| // handles caching and rendering templates | |
| var Template = (function() { | |
| // initialize private method container | |
| var TemplateHandler = function() {}; | |
| // private methods | |
| TemplateHandler.prototype = { | |
| // used to hold the collection of | |
| // key/value cached templates | |
| templates: {}, |
| class Article < ActiveRecord::Base | |
| # ... | |
| def embedded_links | |
| self.body_html.scan(/<a.+?href="(.+?)".+?/) if body_html | |
| end | |
| def has_links? | |
| self.embedded_links.flatten.present? | |
| end |
| // Usage: | |
| // $(function() { $(document).autosave(); }); | |
| (function($) { | |
| // initialize the namespace with an empty timer | |
| $.autosave = { timer: null }; | |
| // NOTE: all actionable methods below provide hooks that you can | |
| // bind to as needed (both before/after hooks are triggered) |