Skip to content

Instantly share code, notes, and snippets.

View scripting's full-sized avatar

Dave Winer scripting

View GitHub Profile
@scripting
scripting / canvasImage
Created June 29, 2014 19:43
Why doesn't the image in this example scale to fill the canvas?
<html>
<head>
<title>Canvas Lab</title>
<style>
body {
background-color: whitesmoke;
}
.divPage {
margin-top: 125px;
@scripting
scripting / serverCodeForTwitter
Last active August 29, 2015 14:03
A bit of server code, referenced in a blog post on Scripting News
//see this blog post for background -- http://scripting.com/2014/07/01/twitterApiUpdatewithmedia.html
var buffer = new Buffer (body, "base64");
var params = {
url: "https://api.twitter.com/1.1/statuses/update_with_media.json",
oauth: {
consumer_key: process.env.twitterConsumerKey,
consumer_secret: process.env.twitterConsumerSecret,
token: parsedUrl.query.oauth_token,
token_secret: parsedUrl.query.oauth_token_secret
//referenced in this blog post -- http://scripting.com/2014/07/01/twitterApiUpdatewithmedia.html
function tweetImage (status) {
var theCanvas = document.getElementById ("idCanvas");
var urlImage = theCanvas.toDataURL ();
var imgType = "image/png";
function encode (s) {
return (encodeURIComponent (s));
}
@scripting
scripting / correctedStatusMedia
Created July 1, 2014 14:13
Updated code snippet for a Scripting News blog post, with corrected code
//Goes with this blog post -- http://scripting.com/2014/07/01/twitterApiUpdatewithmedia.html#aIJWTS
var params = {
url: "https://api.twitter.com/1.1/statuses/update_with_media.json",
oauth: {
consumer_key: process.env.twitterConsumerKey,
consumer_secret: process.env.twitterConsumerSecret,
token: parsedUrl.query.oauth_token,
token_secret: parsedUrl.query.oauth_token_secret
@scripting
scripting / RiverReader
Last active August 29, 2015 14:03
Minimal code for reading a river
<html>
<head>
<title>Minimal River Reader</title>
<script src="http://fargo.io/code/jquery-1.9.1.min.js"></script>
</head>
<body>
<script>
var theRiver;
function onGetRiverStream (updatedFeeds) {
theRiver = updatedFeeds;
@scripting
scripting / gist:f289b2d36316964bf399
Created September 13, 2014 19:37
Example of JSON test that is sent by Radio3 to a server that's hooked in
{
"guid": {
"flPermalink": true,
"value": "http://thefuturebuzz.com/2013/08/15/the-slow-inevitable-death-of-cable-tv/"
},
"text": "The Slow, Inevitable Death Of Cable TV.",
"title": "",
"link": "http://thefuturebuzz.com/2013/08/15/the-slow-inevitable-death-of-cable-tv/",
"linkShort": "http://bit.ly/1q1p56Y",
"whenLastEdit": "2014-09-13T19:35:48.808Z",
@scripting
scripting / gist:24a97569e8103799d942
Created September 19, 2014 12:50
An example of the metadata Twitter keeps about an individual tweet.
{
"created_at": "Fri Sep 19 12:20:23 +0000 2014",
"id": 512939257850511360,
"id_str": "512939257850511360",
"text": "\"I never used the Blackberry again.\" https://t.co/CYsbbBDtOh",
"source": "<a href=\"http://radio3.io/\" rel=\"nofollow\">radio3.io</a>",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
@scripting
scripting / gist:afc95f1b951978c58ad7
Created September 20, 2014 12:39
CORS config for S3 bucket that allows access from River Browser
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
@scripting
scripting / gist:f807694bf08f85599717
Created January 8, 2015 17:05
A script I have running as an endpoint on my PagePark server.
var s = "";
for (var i = 1; i < 1000; i++) {
s += i + "\r\n";
}
s;
@scripting
scripting / config.json
Created January 17, 2015 09:37
An example of a config.json file used for the tweetsToRss app.
{
"folder": "feeds/",
"items": [
{
"username": "Circa",
"feedname": "circa.xml"
},
{
"username": "reportedly",
"feedname": "reportedly.xml"