Skip to content

Instantly share code, notes, and snippets.

View pkpp1233's full-sized avatar

Paul Katsen pkpp1233

View GitHub Profile
@pkpp1233
pkpp1233 / cloud.js
Last active April 15, 2022 15:40
Wordcloud using Python scraper on Blockspring
// Word cloud layout by Jason Davies, http://www.jasondavies.com/word-cloud/
// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf
(function() {
function cloud() {
var size = [256, 256],
text = cloudText,
font = cloudFont,
fontSize = cloudFontSize,
fontStyle = cloudFontNormal,
fontWeight = cloudFontNormal,
@pkpp1233
pkpp1233 / wordcloud.js
Last active January 20, 2019 20:39
node wordcloud
var d3 = global.d3 = require('d3');
var cloud = require('d3.layout.cloud');
// Declare inputs and initiate wordcloud draw.
(function(){
var text = "SCENE II. Paris. The KING's palace.\n\nFlourish of cornets. Enter the KING of France, with letters, and divers Attendants\nKING\nThe Florentines and Senoys are by the ears;\nHave fought with equal fortune and continue\nA braving war.\nFirst Lord\nSo 'tis reported, sir.\nKING\nNay, 'tis most credible; we here received it\nA certainty, vouch'd from our cousin Austria,\nWith caution that the Florentine will move us\nFor speedy aid; wherein our dearest friend\nPrejudicates the business and would seem\nTo have us make denial.\nFirst Lord\nHis love and wisdom,\nApproved so to your majesty, may plead\nFor amplest credence.\nKING\nHe hath arm'd our answer,\nAnd Florence is denied before he comes:\nYet, for our gentlemen that mean to see\nThe Tuscan service, freely have they leave\nTo stand on either part.\nSecond Lord\nIt well may serve\nA nursery to our gentry, wh
@pkpp1233
pkpp1233 / gist:6407380bd75e0470950e
Last active October 11, 2016 21:43
fullsies.js
var blockspring = require("blockspring");
var requests = require("request");
var fs = require("fs");
blockspring.define(function(request, response) {
name = "Hi! My name is " + request.params.first_name;
age = " and my age is " + request.params.age.toString();
response.addOutput('intro', name + age);
console.log('hi');
@pkpp1233
pkpp1233 / index.html
Created January 9, 2014 00:45
newguy
<html>
<head>
<script src="test.js"></script>
</head>
<body>
<div id="chart">
<svg>
</svg>
</div>
</body>
@pkpp1233
pkpp1233 / gist:606818de22072f9929c2
Created February 12, 2015 20:37
Verbose curl command to Blockspring test function.
curl -v -H "Content-Type: application/json" -d "{ \"first_name\": \"Paul\", \"age\": 26 }" "https://sender.blockspring.com/api_v2/blocks/455dfb41d40d13281ef87e613a669827?api_key=YOUR_API”_KEY
@pkpp1233
pkpp1233 / block.js
Created December 11, 2014 21:02
Blockspring wordcloud.
var blockspring = require('blockspring');
var d3 = global.d3 = require('d3');
var fs = require('fs');
var cloud = require('d3.layout.cloud');
blockspring.define(function(request, response){
var text = request.params.text,
width = request.params.width,
height = request.params.height,
rotate_words = request.params.rotate_flag,
@pkpp1233
pkpp1233 / cloud.svg
Created December 11, 2014 02:48
svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="cloud.js"></script>
</head>
<body>
<script>
// Declare inputs and initiate wordcloud draw.
(function(){
var text = "SCENE II. Paris. The KING's palace.\n\nFlourish of cornets. Enter the KING of France, with letters, and divers Attendants\nKING\nThe Florentines and Senoys are by the ears;\nHave fought with equal fortune and continue\nA braving war.\nFirst Lord\nSo 'tis reported, sir.\nKING\nNay, 'tis most credible; we here received it\nA certainty, vouch'd from our cousin Austria,\nWith caution that the Florentine will move us\nFor speedy aid; wherein our dearest friend\nPrejudicates the business and would seem\nTo have us make denial.\nFirst Lord\nHis love and wisdom,\nApproved so to your majesty, may plead\nFor amplest credence.\nKING\nHe hath arm'd our answer,\nAnd Florence is denied before he comes:\nYet, for our gentlemen that mean to see\nThe Tuscan service, freely have th
@pkpp1233
pkpp1233 / cloud.js
Created December 11, 2014 01:01
wordcloud
// Word cloud layout by Jason Davies, http://www.jasondavies.com/word-cloud/
// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf
(function() {
function cloud() {
var size = [256, 256],
text = cloudText,
font = cloudFont,
fontSize = cloudFontSize,
fontStyle = cloudFontNormal,
fontWeight = cloudFontNormal,