Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@donfrancisco
donfrancisco / server.js
Created August 27, 2012 04:55 — forked from atian25/server.js
socket.io + express session
//express3.0
var express = require('express');
var app = express();
app.set('port', 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
//session & cookie
@donfrancisco
donfrancisco / .gitignore
Created August 17, 2012 16:29 — forked from bergie/.gitignore
Node.js email handling examples
config.json
reading-image.png
# Google Calendar access w/ Data API
# OAuth authentication.
require "sinatra"
require "excon"
require "cgi"
require "base64"
require "openssl"
require "digest/hmac"
require "json/pure"
@donfrancisco
donfrancisco / postgresapp_induction_rails.md
Created July 20, 2012 11:49 — forked from alexagui/postgresapp_induction_rails.md
Migrate a Rails project to Postgresql with Postgres.app and Induction

I had issues installing Postgres with the instructions in this Railscast. However I was able to get postgres running on my project with http://postgresapp.com/ and http://inductionapp.com/ (Hat tip to this stackoverflow thread).

  1. Download & install Postgres.app (documentation) Make sure to install in /Applications.
  2. Update your PATH
    In my case I added the following to ~/.bash_profile
    export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
    Check that Postgres.app is being loaded
$ which psql
/Applications/Postgres.app/Contents/MacOS/bin/psql
require 'rubygems'
require 'sinatra'
require 'httparty'
class Representative
include HTTParty
end
get '/' do
erb :form
end
get '/:username' do
@donfrancisco
donfrancisco / index.html
Created May 31, 2012 22:44 — forked from alunny/index.html
simple PhoneGap File API example
<html>
<body>
<form onsubmit="return saveText()">
<label for="name">Name</label><br>
<input id="name" /><br>
<label for="desc">Description</label><br>
<input id="desc" /><br>
<input type="submit" value="Save" />
@donfrancisco
donfrancisco / fileapisample
Created May 31, 2012 22:40 — forked from alunny/file-api-sample.js
sample usage of the phonegap file api
var writeData = function (filename, data, callback) {
var writeOutData = function () {
var fw = new FileWriter();
fw.oncomplete = callback;
fw.onerror = function () {
alert("Failed to save update");
}
fw.writeAsText("myDir/" + filename, data);
}
@donfrancisco
donfrancisco / cross_domain_proxy.js
Created May 30, 2012 17:36 — forked from ryankirkman/cross_domain_proxy.js
Call an external JSON API via a local cross domain proxy
// See: http://api.jquery.com/jQuery.ajaxPrefilter/
$.ajaxPrefilter( function( options ) {
if ( options.crossDomain ) {
var newData = {};
// Copy the options.data object to the newData.data property.
// We need to do this because javascript doesn't deep-copy variables by default.
newData.data = $.extend({}, options.data);
newData.url = options.url;
// Reset the options object - we'll re-populate in the following lines.