Skip to content

Instantly share code, notes, and snippets.

View abutler3's full-sized avatar

Andrew Butler abutler3

  • Solider of Fortune, Member of The A Team, nephew of B.A. Baracus
  • Nashville, TN
View GitHub Profile
@abutler3
abutler3 / anatomy-backbone-models.js
Created February 28, 2013 01:52
Models examples
// Our Appointment model doesn't seem too useful yet. Add two default attributes,
// title as the string "Checkup", and date which should default to the current time new Date()
var Appointment = Backbone.Model.extend({
defaults: {
title: "Checkup",
date: new Date()
}
});
//While messing around in the console, you've discovered a strange bug. Every new Appointment you create has the same exact date, instead of the date and time of when the Appointment instance was created.
@abutler3
abutler3 / anatomy-backbone.js
Created February 25, 2013 23:42
Backbone.js walkthough
// an Appointment model class.
var Appointment = Backbone.Model.extend({});
// Appointment model class, let's create our first instance and assign it to the appointment variable.
//Pass in a title for the appointment when creating it.
var appointment = new Appointment();
// set the title of the appointment instance! Set it to any string
appointment.set('title', 'My knee hurts');
// we have our very first appointment. But it isn't so useful, sitting there deep down in the bowels of your browser.
//To display it lets first create a view class and name it AppointmentView
var AppointmentView = Backbone.View.extend({
@abutler3
abutler3 / hashtag_question.rb
Created February 18, 2013 15:43
Getting a Bad Authentication data error
# Failure/Error: click_button 'Search'
# Twitter::Error::BadRequest:
# Bad Authentication data
# searches_controller.rb
class SearchesController < ApplicationController
def create
redirect_to search_path(params[:twitter][:search])
end