View sketch.js
function setup() {
createCanvas(400, 300);
serial = new p5.SerialPort(ipAddr); // make a new instance of the serialport library
serial.on('list', printList); // set a callback function for the serialport list event
serial.on('connected', serverConnected); // callback for connecting to the server
serial.on('open', portOpen); // callback for the port opening
serial.on('data', serialEvent); // callback for when new data arrives
serial.on('error'); // callback for errors
serial.on('close'); // callback for the port closing
View img-scrape.py
# This script is a way to quickly download all the thumbnail images for pages at antievictionmap.com
# The script takes one argument: the word after the main URL, so "evictions" or "affordability." To use the script, you would:
# 1. use the command line to navigate to the directory on your computer where the script lives
# 2. type `python img-scrape.py [page you want images from]`, i.e. python img-scrape.py affordability
# The script will create a directory with the argument you typed in and fill it with thumnails from that page.
import requests, os, bs4, sys
View p5.json
{
"!name": "p5.js",
"!define": {
"Conversion": {
"p5": {
"!type": "fn()",
"!url": "https://p5js.org/reference/#/p5/p5",
"prototype": {
"undefined": {
"!type": "fn()",
View autocomplete-todos.md

Bugs

  • Get existing cm.setOption calls to work with the Tern cm.setOption calls
  • Figure out how to link tern.yuidoc as a dependency of p5 so a Grunt task can be created/run to create the Tern definition file each time there are updates
  • Autocomplete is only triggered with a .
  • Suuuper sluggish performance when multiple functions/vars/words register with Tern. Hard to tell whether this is Tern or CodeMirror show-hint

Functionality to add

  • Modal window that describes Tern keys (like existing keyboard shortcuts modal)
  • Toggle/keyboard shortcut to turn on Tern stuff
    • probably in "Settings: General" (see new Jerel design on Zeplin)
View p5-tern.md

Generating a Tern.js defs file for p5.js

Goal

p5 source code --> YUIDoc JSON --> Tern defs JSON

Process

Because p5.js uses YUIDoc to generate documentation, I'm using @angelozerr's tern.yuidoc plugin to generate a Tern.js defs file for p5.js. Ultimately, this will be used to implement code hints and autocomplete in the p5.js web editor.

  1. Get the p5.js API JSON file from the p5 website, here. Learn more about the p5.js API JSON file here.
  2. Then, get the Tern defs generator. Clone @angelozerr's repo with $ git clone https://github.com/angelozerr/tern.yuidoc
View baldwin-spencer.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View baldwin.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View spencer-followers.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View writeToIframe.js
// http://stackoverflow.com/questions/16504816/how-to-set-html-content-into-an-iframe
function writeToIframe() {
var htmlScript = "<!DOCTYPE html>
<meta charset='utf-8'>
<title>Preview</title>
<body>
<script src='https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.3/addons/p5.dom.min.js'></script>
<script src='preview-frame.bundle.js'></script>
</body>";
View embed-orig.js
define("components/app-button", ["exports", "module", "flight/index", "../mixins/browser-info", "../mixins/page-info"], function (exports, module, _flightIndex, _mixinsBrowserInfo, _mixinsPageInfo) {
"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var flight = _interopRequire(_flightIndex);
var BrowserInfo = _interopRequire(_mixinsBrowserInfo);
var PageInfo = _interopRequire(_mixinsPageInfo);