Skip to content

Instantly share code, notes, and snippets.

// Document Model
dc.model.Document = Backbone.Model.extend({
constructor : function(attrs, options) {
attrs.selected = false;
attrs.selectable = true;
if (attrs.annotation_count == null) attrs.annotation_count = 0;
Backbone.Model.call(this, attrs, options);
var id = this.id;
// Main controller for the journalist workspace. Orchestrates subviews.
dc.controllers.Workspace = Backbone.Controller.extend({
routes : {
'help/:page': 'help',
'help': 'help'
},
// Initializes the workspace, binding it to <body>.
initialize : function() {
$ rvm install jruby
$ rvm --create jruby@torquebox
$ gem install bundler
$ gem install torquebox-server --pre --source http://torquebox.org/2x/builds/LATEST/gem-repo/
$ gem install rails
$ rails new myapp -m $(torquebox env TORQUEBOX_HOME)/share/rails/template.rb
$ cd myapp
$ torquebox deploy
$ torquebox run
@johnpaulashenfelter
johnpaulashenfelter / upgrade_homebrew_pg.sh
Created November 11, 2011 15:31
Upgrading homebrew postgres from 9.0.x to 9.1
Upgrading to homebrew postgresql 9.1.1 from 9.0.x
* Copy the old data
mv -R /usr/local/var/postgres/ /usr/local/var/postgres-901
* Create a new database using 9.1.1
/usr/local/Cellar/postgresql/9.1.1/bin/initdb /usr/local/var/postgres
@jamesarosen
jamesarosen / ember-views-and-states.md
Created January 11, 2012 00:21
On Ember Views & States

I have a state machine for the major sections of the page:

App.States = Ember.StateManger.create({
  foo: Ember.State.create({})
});

I have a view that needs to reset itself whenever the user enters the foo state:

@enthal
enthal / index.html
Created January 28, 2012 20:36
Example of d3 axis() for axes and grid lines
<!DOCTYPE html>
<html>
<head>
<title>D3 - Line Chart - axes and grid using axis()</title>
<!-- script type="text/javascript" src="https://raw.github.com/jquery/sizzle/master/sizzle.js"></script -->
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.min.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.min.js"></script>
<style type="text/css">
body {
@fetep
fetep / config
Created March 6, 2012 14:45
sample logstash config for rails log line
input {
stdin {
type => rails
}
}
filter {
grok {
type => "rails"
pattern => "Completed %{GREEDYDATA:operation} in %{NUMBER:time:int}ms"
@lukemelia
lukemelia / config.ru
Created March 23, 2012 03:26
rake pipeline rack config
require 'bundler/setup'
require 'sass'
require 'compass'
require 'rake-pipeline'
require 'listen'
require 'rack/lock'
require 'ruby-debug'
require 'securerandom'
STDOUT.sync = true
@srinivasmohan
srinivasmohan / whatsmyname.rb
Last active October 3, 2015 18:27
Chef recipe (snippets) to setup FQDN, hostname, IP etc properly
#Knife invocations supply FQDN as the node name at creation time and this becomes hostname( option -N)
execute "Configure Hostname" do
command "hostname --file /etc/hostname"
action :nothing
end
#Ensure the hostname of the system is set to knife provided node name
file "/etc/hostname" do
content node.name
@rlivsey
rlivsey / 1-helper.js
Created May 3, 2012 19:53 — forked from wagenet/1-helper.js
Ember Handlebars Transform Helper
Ember.HandlebarsTransformView = Ember.View.extend(Ember._Metamorph, {
rawValue: null,
transformFunc: null,
value: function(){
var rawValue = this.get('rawValue'),
transformFunc = this.get('transformFunc');
return transformFunc(rawValue);
}.property('rawValue', 'transformFunc').cacheable(),