Skip to content

Instantly share code, notes, and snippets.

import os
import json
import http.client as httplib
import httplib2
import ssl
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from googleapiclient.http import MediaFileUpload
from googleapiclient.errors import HttpError
import time
@sbc
sbc / cloudcamp_email_conf
Created June 30, 2013 07:07
Email confirmation for first #CloudCamp - 6/24/2008
Thank you for registering for CloudCamp San Francisco being held this evening Tuesday, June 24th at the 835 Market Street, Suite 700 (Microsoft San Francisco). We're looking forward to seeing you there, and we expect the event to be both stimulating and entertaining. We'll have plenty of food and drink on hand and CloudCamp t-shirts for the first 200 attendees.
Below are all the details to help coordinate your attendance.
DATE & TIME
June 24th – 5:00 PM - 9:00 PM, Party to Follow
LOCATION
Microsoft San Francisco
835 Market Street, Suite 700
Post.find 2, (post) -> # Loads entity from /posts/2
post('title') # Returns 'Test post'
post('title', 'New and better title!') # Sets new title value
post('title') # Returns 'New and better title!'
post.reload -> # Reloads fields from server
post('title') # Returns 'Test post'
post.delete -> console.log 'Deleted!' # Deletes fetched entity (DELETE /posts/2)
@sbc
sbc / gist:986221
Created May 23, 2011 04:19
URL when controller renders home page on error
# - Home page has a subscription form on it.
# - Form is posted to create action of SubscribersController.
# - When error occurs, controller renders home page
# - URL in browser is http://app.example.com/subscribers
# - I want it to be just http://app.example.com
class SubscribersController < ApplicationController
def create
@subscriber = Subscriber.new(params[:subscriber])
@sbc
sbc / rails_tutorial_notes.markdown
Created May 7, 2011 13:41
Rails Tutorial Notes

Rails Tutorial Notes

Project Setup

  1. $ rails new sample_app -T # -T ~ no Test::Unit

  2. #Update Gemfile (rspec, webrat)

  3. $ bundle install

  4. $ rails g rspec:install

  5. git init; git add .; git commit -m ‘Initial commit’

@sbc
sbc / prettyprint.py
Created December 25, 2010 20:03
PrettyPrinting objects in Python
import pprint
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(object)