Skip to content

Instantly share code, notes, and snippets.

View paul's full-sized avatar

Paul Sadauskas paul

View GitHub Profile
@paul
paul / railsconf.md
Last active June 1, 2016 15:52
RailsConf 2016

Overview

Traveled by motorcycle (1300 miles roundtrip) from Boulder, CO to Kansas City, MO and back again.

Schedule

Wednesday

  • Keynote (Jeremy Daer)
  • Didn't find this keynote to be of much value. It meandered and ran over allotted time.
Viz.WidgetsController = Ember.ArrayController.extend
init: ->
@refresh()
setInterval (=> @refresh()), 5000
refresh: ->
$.ajax
url: @get('src'),
type: "GET",
context: this,

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?

@paul
paul / gist:981186
Created May 19, 2011 16:33 — forked from TwP/gist:981176
Using AD's ParamsParser middleware
require 'yajl'
module Ssaj
PARSER = Proc.new do |data|
HashWithIndifferentAccess.new(Yajl::Parser.parse(data))
end
ActionDispatch::ParamsParser::DEFAULT_PARSERS[Mime::SSAJ1] = PARSER
class MyResource
include Spinal::Resource
attribute :foo, String, :required => true
attribute :bar, Integer
render(:html).with(:template => 'my_resource')
render(:json).with(JsonRenderer)
def self.load(id)
<h1><%= header %></h1>
<% if not item.empty? %>
<ul>
<% for i in item %>
<% if i[:current] %>
<li><strong><%= i[:name] %></strong></li>
<% else %>
<li><a href="<%= i[:url] %>"><%= i[:name] %></a></li>
<% end %>
<% end %>
require 'pp'
#
# Cookbook Name:: postgres
# Recipe:: default
#
execute "init-postgres" do
command "if [ ! -d /var/lib/postgresql/8.3/data ]; then\nsu - postgres -c 'initdb -D /var/lib/postgresql/8.3/data'\nfi"
action :run
end
class Instance
include DataMapper::Resource
class Adapter < AbstractAdapter
# define CRUD
end
@adapter = Adapter.new(:connection => foo)
repository DM.setup(@adapter)
class DataMapper::Property
# translate the value from external source to expected object
def typecast(value)
value
end
# translate the value from the primitive to expected object
def load(value)
value