Create Google Drive webViewLink folders via JavaScript (You must change CLIENT_ID before this will work.)
These folders are suitable for publishing websites. Once the folder is created, simply upload index.html and other resources to the folder.
using System; | |
using System.Web.Mvc; | |
using Divan; | |
using Newtonsoft.Json; | |
namespace CouchTest.Controllers | |
{ | |
[HandleError] | |
public class HomeController : Controller | |
{ |
function getJSON(aUrl,sheetname) { | |
//var sheetname = "test"; | |
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json"; | |
var response = UrlFetchApp.fetch(aUrl); // get feed | |
var dataAll = JSON.parse(response.getContentText()); // | |
var data = dataAll.value.items; | |
for (i in data){ | |
data[i].pubDate = new Date(data[i].pubDate); | |
data[i].start = data[i].pubDate; | |
} |
// Implements multipart/form-data POST in C# http://www.ietf.org/rfc/rfc2388.txt | |
// http://www.briangrinstead.com/blog/multipart-form-post-in-c | |
public static class FormUpload | |
{ | |
private static readonly Encoding encoding = Encoding.UTF8; | |
public static HttpWebResponse MultipartFormDataPost(string postUrl, string userAgent, Dictionary<string, object> postParameters) | |
{ | |
string formDataBoundary = String.Format("----------{0:N}", Guid.NewGuid()); | |
string contentType = "multipart/form-data; boundary=" + formDataBoundary; |
/* Queue to use in conjuction with xhr functionality */ | |
var requestQ = (function() { | |
var numRequestToComplete, requestsCompleted, callBacks, singleCallBack; | |
return function(options) { | |
if (!options) options = {}; | |
numRequestToComplete = options.numRequest || 0; | |
requestsCompleted = options.requestsCompleted || 0; | |
callBacks = []; | |
var fireCallbacks = function() { | |
/* alert("we're all complete"); */ |
Create Google Drive webViewLink folders via JavaScript (You must change CLIENT_ID before this will work.)
These folders are suitable for publishing websites. Once the folder is created, simply upload index.html and other resources to the folder.
/** | |
reference - | |
https://developers.google.com/accounts/docs/OAuth2WebServer | |
https://code.google.com/apis/console/ | |
https://developers.google.com/+/api/latest/ | |
**/ | |
////handle all requests here | |
function doGet(e) { |
/* | |
Simplest method to do a REST API calls in c# with basic .NET classes. | |
I use it when communicationg with Recurly.com REST services. | |
*/ | |
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.IO; |
################################################################# | |
# | |
# File: lib/api.rb | |
# | |
################################################################# | |
require 'user' # ActiveRecord model | |
# Connect to the db | |
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL']) |
function sign_s3(access_key, private_key, bucket, object_name, validity, base_url) { | |
if(!base_url) { | |
base_url = "http://s3.amazonaws.com"; | |
} | |
if(!validity) { | |
validity = 60; | |
} | |
expires = Math.floor((new Date()).getTime() / 1000) + validity; | |
object_name = encodeURIComponent(object_name); | |
stringToSign = "GET\n\n\n"+expires+"\n/"+bucket+"/"+object_name; |