Skip to content

Instantly share code, notes, and snippets.

(function($){
//
//-------------------------------------- Model : Image
//
Image = Backbone.Model.extend({
defaults: {
'delete' : false
}
});

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev

class AccountSignup
def self.new(warden, acccount_params)
account = Subscribem::Account.create(account_params)
account.create_schema
UserSignup.new(warden, account, account.owner)
end
end
@dbkbali
dbkbali / nesting.coffee
Created July 25, 2012 12:13 — forked from lagartoflojo/nesting.coffee
Helper function for nesting Backbone collections (CoffeeScript version)
Backbone.Model::nestCollection = (attributeName, nestedCollection) ->
#setup nested references
for item, i in nestedCollection
@attributes[attributeName][i] = nestedCollection.at(i).attributes
#create empty arrays if none
nestedCollection.bind 'add', (initiative) =>
if !@get(attributeName)
@attributes[attributeName] = []
@get(attributeName).push(initiative.attributes)
@dbkbali
dbkbali / nesting.js
Created July 25, 2012 12:13 — forked from geddski/nesting.js
helper function for nesting backbone collections.
function nestCollection(model, attributeName, nestedCollection) {
//setup nested references
for (var i = 0; i < nestedCollection.length; i++) {
model.attributes[attributeName][i] = nestedCollection.at(i).attributes;
}
//create empty arrays if none
nestedCollection.bind('add', function (initiative) {
if (!model.get(attributeName)) {
model.attributes[attributeName] = [];
@dbkbali
dbkbali / application.js
Created May 7, 2012 08:41
Application.JS file for Backbone Problem with JST/Handlebars Template
/*!
* jQuery JavaScript Library v1.7.2
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
@dbkbali
dbkbali / application.js
Created May 7, 2012 08:41
Application.JS file for Backbone Problem with JST/Handlebars Template
/*!
* jQuery JavaScript Library v1.7.2
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
@dbkbali
dbkbali / loc_form.jst.hbs
Created May 5, 2012 09:24
Backbone Files Causing problem location_form.js.coffee is nested in another view
<div class = "fieldset-header">{{this.header}}
<h3>New/Edit Location {{header}} {{loc}}</h3>
</div>
<form action="" method="post" enctype="multipart/form-data" name="loc" class="form account" id="location-form">
<div class= "span12 field-line">
<div class="row">
<div class="span6">
<fieldset id="location-address">
<legend class="small">Address</legend>
<div class="control-group location address">
@dbkbali
dbkbali / frozen_hash_console_output
Created October 12, 2011 09:28
Console Output mongoid globalize frozen-hash
ruby-1.9.2-p290-patched :001 > act = Activity.create(:name => "exercise")
=> #<Activity _id: 4e9559899a4b7c3b7c000002, _type: nil, category_ids: [], slug: "exercise", name: "exercise">
ruby-1.9.2-p290-patched :002 > act.translations
=> [#<Activity::Translation _id: 4e9559899a4b7c3b7c000001, _type: "Activity::Translation", locale: "en", name: "exercise">]
ruby-1.9.2-p290-patched :003 > act.reload
=> #<Activity _id: 4e9559899a4b7c3b7c000002, _type: nil, category_ids: [], slug: "exercise", name: "exercise">
ruby-1.9.2-p290-patched :004 > act.delete
RuntimeError: can't modify frozen hash
from /Users/dbk/Development/mongoid_globalize/lib/mongoid_globalize/instance_methods.rb:18:in `merge!'
from /Users/dbk/Development/mongoid_globalize/lib/mongoid_globalize/instance_methods.rb:18:in `attributes'
@dbkbali
dbkbali / application.js.coffee
Created July 11, 2011 10:48 — forked from ddemaree/application.js.coffee
Simple Google Maps API v3 integration in CoffeeScript, with non-JS Static Maps fallback
#= require jquery
#= require jquery_ujs
#= require lib/modernizr
#= require lib/jquery.lettering
#= require_tree .
$ ->
$('*[data-googlemap]').googleMap()
true