Skip to content

Instantly share code, notes, and snippets.

View atypical's full-sized avatar

MDavid Low atypical

View GitHub Profile
@atypical
atypical / oauth.js
Created October 4, 2011 22:48
xAuth, Appcelerator and Tumblr
/*
* Copyright 2008 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@atypical
atypical / blah.js
Created October 27, 2011 21:03
Tumblr User Request
function getUserInfo(){
var tokenKey = Ti.App.Properties.getString('TumblrOAuthTokenKey');
var tokenSecret = Ti.App.Properties.getString('TumblrOAuthTokenSecret');
var oauth = OAuth({
consumerKey: 'abababababababababababababababababbababababba',
consumerSecret: 'abababababababababababababababababbababababba'
//You said you have keys, but if yours aren't xauth, let me know and I can pass mine along.
});
@atypical
atypical / example.js
Created October 29, 2011 21:46
example
userTimeline: function (screenName, sinceId, success, failure, options)
{
options = options || {};
var url = OAuth.Twitter.API_URL +
OAuth.Twitter.API_VERSION +
OAuth.Twitter.API_USER_TIMELINE + '.' +
OAuth.Twitter.API_FORMAT;
var userId = parseInt(screenName, 10);
if (userId == screenName)
@atypical
atypical / example2.js
Created October 29, 2011 21:50
example 2
twitter.userTimeline(function(data) {
var returnedParams = JSON.parse(data.text);
Ti.API.info('returnedParams: '+returnedParams);
function success(data)
{
Ti.API.info('Response text: '+JSON.parse(data.text));
}
function failure(data)
userInfo: function (success, failure)
{
var url = OAuth.Tumblr.API_URL +
OAuth.Tumblr.API_VERSION +
OAuth.Tumblr.API_USER_INFO;
this.oauth.postJSON(url, success, failure);
return this;
},
@atypical
atypical / detail.js
Created October 29, 2011 22:27
getUserInfo()
function getUserInfo(){
var tumblr = new OAuth.Tumblr({
consumerKey: 'adfasdfasdfasdfasdfas',
consumerSecret: 'adfasdfasdfasdfasdfsa'
});
function success(data)
"posts":[
{"blog_name":"fuckyeahtattoos",
"id":12132753374,
"post_url":"http:\/\/fyeahtattoos.com\/post\/12132753374\/a-dog-eared-life-is-part-of-a-poem-my-dad-wrote",
"type":"photo",
"date":"2011-10-30 21:37:05 GMT",
"timestamp":1320010625,
"format":"html",
"reblog_key":"07oX4N30",
"tags":["tattoos","submission"],
@atypical
atypical / blah.js
Created October 30, 2011 23:56
Read and Clean
function parseTheDashboardData(resp){
var httpStatus = resp.meta.status,
httpMessage = resp.meta.msg,
dashboardPostsArray = resp.response.posts;
for (var i = 0; i < dashboardPostsArray.length; i++){
var current=dashboardPostsArray[i];
var blogName = current.blog_name,
blogID = current.id,
@atypical
atypical / blah.js
Created October 31, 2011 00:52 — forked from danro/blah.js
Read and Clean
function parseTheDashboardData(resp){
var httpStatus = resp.meta.status,
httpMessage = resp.meta.msg,
dashboardPostsArray = resp.response.posts;
for (var i = 0; i < dashboardPostsArray.length; i++){
var current=dashboardPostsArray[i];
var blogName = current.blog_name,
blogID = current.id,
@atypical
atypical / blah.js
Created November 22, 2011 20:53
blah.js
var front = Ti.UI.createImageView({
backgroundImage: _args.data.image || '',
backgroundColor:"#000",
borderWidth:3,
borderColor:'#FFF',
top:0,
bottom:0,
left:0,
right:0,
zIndex:1,