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
//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 |
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
//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)); | |
} |
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
//https://dl.dropboxusercontent.com/u/17365636/web/jsGradient.js | |
jsgradient = { | |
inputA : '', | |
inputB : '', | |
inputC : '', | |
gradientElement : '', | |
// Convert a hex color to an RGB array e.g. [r,g,b] | |
// Accepts the following formats: FFF, FFFFFF, #FFF, #FFFFFF | |
hexToRgb : function(hex){ |
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
/* round("M -0.09375,-3 A 1.001098,1.001098 0 1 0 0,-1 C 0.56412939,-1 1,-0.56412939 1,0 1,0.27245181 0.8799664,0.4950336 0.6875,0.6875 A 1.016466,1.016466 0 1 0 2.125,2.125 C 2.6563912,1.5936088 3,0.83211769 3,0 3,-1.6450096 1.6450096,-3 0,-3 a 1.0001,1.0001 0 0 0 -0.09375,0 z") | |
=> "M -0.1,-3 A 1,1 0 1 0 0,-1 C 0.6,-1 1,-0.6 1,0 1,0.3 0.9,0.5 0.7,0.7 A 1,1 0 1 0 2.1,2.1 C 2.7,1.6 3,0.8 3,0 3,-1.6 1.6,-3 0,-3 a 1,1 0 0 0 -0.1,0 z" | |
*/ | |
function round (path) { | |
return path.replace(/[\d\.-][\d\.e-]*/g, function(n){return Math.round(n*10)/10}) | |
} |
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
"partial": function( chunk, context, bodies, params ){ | |
var partial_context = {}; | |
/* optional : context fo server processed partial related data*/ | |
var p_context = context.get("partial"); | |
if(p_context || params) { | |
// add to the partial context | |
} | |
return bodies.block( chunk, dust.makeBase(partial_context)); | |
} |
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
d3.select("#save").on("click", function(){ | |
var html = d3.select("svg") | |
.attr("version", 1.1) | |
.attr("xmlns", "http://www.w3.org/2000/svg") | |
.node().parentNode.innerHTML; | |
//console.log(html); | |
var imgsrc = 'data:image/svg+xml;base64,'+ btoa(html); | |
var img = '<img src="'+imgsrc+'">'; | |
d3.select("#svgdataurl").html(img); |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Marionette Dust Example</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<script type="text/javascript" src="node_modules/lodash/lodash.js"></script> | |
<script type="text/javascript" src="node_modules/backbone/backbone.js"></script> |
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
(function(global, undefined) { | |
"use strict"; | |
var Pocket = (function() { | |
var https = require("https"); | |
function Pocket(opt) { | |
this.consumer_key = opt.consumer_key; | |
this.access_token = opt.access_token; | |
} |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000