This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'httparty' | |
class Representative | |
include HTTParty | |
end | |
get '/' do | |
erb :form | |
end | |
get '/:username' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Choice: | |
fields: | |
default: choice, question_id, question | |
form: choice, question_id, question | |
order_by: | |
relationships: question | |
filters: created_at, question | |
search: | |
application: survey |
NewerOlder