Skip to content

Instantly share code, notes, and snippets.

@donfrancisco
donfrancisco / gist:adf164d8a9f271029ec0
Created January 5, 2015 05:11
OSX Yosemite show hidden files and folders

Show Hidden:

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

and to hide them:

defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

Choice:
fields:
default: choice, question_id, question
form: choice, question_id, question
order_by:
relationships: question
filters: created_at, question
search:
application: survey
@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.
@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 / 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 / httpartyexample.rb
Created June 15, 2012 10:37
httparty example
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require File.join(dir, 'httparty')
require 'pp'
config = YAML::load(File.read(File.join(ENV['HOME'], '.twitter')))
class Twitter
include HTTParty
base_uri 'twitter.com'
def initialize(u, p)
require 'HTTParty'
response = HTTParty.get("https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&screen_name=instagram&count=10")
puts result[0]['entities']['media'][0]['media_url']
require 'rubygems'
require 'sinatra'
require 'httparty'
class Representative
include HTTParty
end
get '/' do
erb :form
end
get '/:username' do
@donfrancisco
donfrancisco / sublimesymlink.sh
Created June 16, 2012 07:49
Sublime 2 command line symlink OSX
@donfrancisco
donfrancisco / gist:2940467
Created June 16, 2012 08:11
redis twitter datastore
require "httparty"
require "redis"
require_relative "../models/twitter_status" # some wrapper for a Twitter status
class TwitterStream
attr_reader :twitter_handle, :tweets
attr_reader :cache # a helper to the Redis database
attr_reader :cached_response # the actual response from a API call
that is put into the cache