Skip to content

Instantly share code, notes, and snippets.

View paul's full-sized avatar

Paul Sadauskas paul

View GitHub Profile
class Conductor
include ActiveModel::Conversion
extend ActiveModel::Naming
include ActiveModel::Validations
class_attribute :object_names
def self.presents(*object_names)
self.object_names = object_names
object_names.each do |object_name|

Desired URLs:

/accounts/rando-inc   # edit, update (normal "edit" function provided at whats usually "show") 
  /tokens             # new, create, destroy (normal crud)
  /billing            # edit, update         (singleton crud)

Attempt using scopes and macros:

scope '/accounts/:permalink',

arr = [1,2,3]
{{#each }}
{{this}},
{{/each}}
produces:
1,2,3,
(ns seraph.test.api
(:use
[clojure.test]
[picard test helpers])
(:require
[seraph.config :as config]
[seraph.routing :as routing]))
(defn handle-request
[{host :host :as hdrs} body]
(ns seraph.test.redirect
(:use
clojure.test
picard.test
picard.helpers
seraph.redirect))
(defn handle-request
[{path-info :path-info :as hdrs} body]
(cond
$(function() {
callbacks = [];
inlineImages = function(content) {
content.find('a').each(function() {
if (/\.(gif|jpe?g|png)/i.test($(this).text()))
$(this).html('<img src="'+$(this).text()+'"/>')
});
};
callbacks.push(inlineImages);
$(function() {
callbacks = [];
inlineImages = function(content) {
content.find('a').each(function() {
if (/\.(gif|jpe?g|png)/i.test($(this).text()))
$(this).html('<img src="'+$(this).text()+'"/>')
});
};
callbacks.push(inlineImages);
$(function() {
callbacks = [];
inlineImages = function(content) {
content.find('a').each(function() {
if (/\.(gif|jpe?g|png)/i.test($(this).text()))
$(this).html('<img src="'+$(this).text()+'"/>')
});
}
callbacks.push(inlineImages)

Sproutcore 2.0 questions

I'm trying to write a complicated app in SC2. There's no editing component yet, just a display of (lots of data). Starting from the Todos & Handlebars guides, here's some of the stuff I've had to google for, or wasn't readily obvious.

Note: I like coffeescript and haml

  • Why is there sometimes references to SC.ArrayController?

    • Colin C: it was gone but its back now. we need to generate the docs again.
  • Why is App.fooController an SC.Object, and App.foosController an SC.ArrayProxy? Shouldn't there just be a generic SC.Controller, or SC.CollectionController, if the behavior is different?

Sproutcore 2.0 questions

I'm trying to write a complicated app in SC2. There's no editing component yet, just a display of (lots of data). Starting from the Todos & Handlebars guides, here's some of the stuff I've had to google for, or wasn't readily obvious.

Note: I like coffeescript and haml

  • Why is there sometimes references to SC.ArrayController?
    • Colin C: it was gone but its back now. we need to generate the docs again.