Skip to content

Instantly share code, notes, and snippets.

View codingjester's full-sized avatar
🙊
Focusing

codingjester

🙊
Focusing
View GitHub Profile
@codingjester
codingjester / upload.php
Created January 20, 2012 22:09
Working PHP example of uploading a photo with V2 api
<?php
#Requires PHP 5.3.0
define("CONSUMER_KEY", "consumer_key");
define("CONSUMER_SECRET", "consumer_secret");
define("OAUTH_TOKEN", "access_token");
define("OAUTH_SECRET", "access_secret");
function oauth_gen($method, $url, $iparams, &$headers) {
@codingjester
codingjester / ajax_jsonp.js
Last active August 6, 2020 15:28
User JQuery with the Tumblr API & JSONP
$.ajax(
'http://api.tumblr.com/v2/blog/codingjester.tumblr.com/posts?api_key=<your_key>',
{
dataType: 'jsonp',
success: function (d) {
console.log(d); // On success log the data to the console
},
}
);
@codingjester
codingjester / xauth_request.py
Last active May 14, 2020 23:40
Python xAuth Example
#!/usr/bin/env python
import urllib
import urlparse
import oauth2 as oauth
import json
consumer_key="consumer_key"
consumer_secret="consumer_secret"
access_token_url = 'https://www.tumblr.com/oauth/access_token'
@codingjester
codingjester / oauth_tumblr.py
Created April 3, 2012 23:33
OAuth Tumblr Getting Access Tokens
import urlparse
import oauth2 as oauth
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
request_token_url = 'http://www.tumblr.com/oauth/request_token'
access_token_url = 'http://www.tumblr.com/oauth/access_token'
authorize_url = 'http://www.tumblr.com/oauth/authorize'
@codingjester
codingjester / three_legged_oauth.py
Last active December 9, 2018 02:34
Tumblr 3 Legged OAuth using Python lib OAuth2
import urlparse
import oauth2 as oauth
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
request_token_url = 'https://www.tumblr.com/oauth/request_token'
access_token_url = 'https://www.tumblr.com/oauth/access_token'
authorize_url = 'https://www.tumblr.com/oauth/authorize'
@codingjester
codingjester / app.go
Created September 1, 2014 00:48
Simple Hello World Golang Web Application
package main
import (
"net/http"
"github.com/gorilla/mux"
)
func main() {
r := mux.NewRouter()
@codingjester
codingjester / xauth.py
Created October 19, 2011 15:59
Using XAuth for Tumblr
#!/usr/bin/env python
import urllib
import urlparse
import oauth2 as oauth
@codingjester
codingjester / etrade.rb
Created August 28, 2013 13:55
Scraping the totalMarketValue of your E*Trade account. Probably could be better. You pass in your username/password as arguments to the script.
require 'mechanize'
a = Mechanize.new
a.get('https://us.etrade.com/home') do |page|
mypage = page.form_with(:action => '/login.fcc') do |f|
f.USER = ARGV[0]
f.PASSWORD = ARGV[1]
end.click_button
jQuery.getJSON(
'http://api.tumblr.com/v2/blog/codingjester.tumblr.com/posts?api_key=<api_key>&jsonp=?',
function(d) {
console.log(d);
});
@codingjester
codingjester / file_cache.py
Last active December 15, 2015 05:19
Simple to disk filecache for python. Why? Because I needed it now.
import json
import stat
DEBUG = True
def debug_cache_data(fn):
def cache_data(*args):
if DEBUG and os.path.exists(fn.__name__):
return json.loads(open(fn.__name__, 'r').read())
else: