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
// creates a readable stream from a figtree - a configuration graph in JSON | |
// continuous stream that allows the browser to start painting ASAP | |
// but retains original file format | |
//but by the time this code calls babel, the style and graph will have already been served, so it will be a subtle delay between page loading and page becoming active | |
/* an example figtree */ | |
{ | |
"styles":["blocks/basic/style.css","blocks/convo/style.css"], | |
"scripts":["utils.js","vanillaClickAndDrag.js","blocks/basic/class.js","blocks/convo/class.js"], |
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
consumeStream(reader, contentType = 'application/json'){ | |
if(!reader) return null // consumeStream will exit if the text was consumed already | |
this.streambuffer || (this.streambuffer = '') //if streambuffer is undefined, create it | |
/* recursively call consumeStream. reader.read() is a promise that resolves as soon as a chunk of data is available */ | |
return reader.read().then(sample => { | |
if(sample.value){ | |
this.streambuffer += textDecoder.decode(sample.value) | |
console.log(this.streambuffer) | |
// if the last character of a chunk of data is a closing bracket, parse the JSON. Otherwise, keep consuming stream until it hits a closing bracket. | |
// this leaves the very unfortunate possible bug of a chunk of data coming in with an escaped bracket at the end, and to detect this condition we'd have to pay attention to opening and closing quotes, except for escaped qutoes |
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
concept: ~genre [ "acoustic" "afrobeat" "alt-rock" "alternative" "ambient" "anime" "black-metal" "bluegrass" "blues" "bossanova" "brazil" "breakbeat" "british" "cantopop" "chicago-house" "children" "chill" "classical" "club" "comedy" "country" "dance" "dancehall" "death-metal" "deep-house" "detroit-techno" "disco" "disney" "drum-and-bass" "dub" "dubstep" "edm" "electro" "electronic" "emo" "folk" "forro" "french" "funk" "garage" "german" "gospel" "goth" "grindcore" "groove" "grunge" "guitar" "happy" "hard-rock" "hardcore" "hardstyle" "heavy-metal" "hip-hop" "holidays" "honky-tonk" "house" "idm" "indian" "indie" "indie-pop" "industrial" "iranian" "j-dance" "j-idol" "j-pop" "j-rock" "jazz" "k-pop" "kids" "latin" "latino" "malay" "mandopop" "metal" "metal-misc" "metalcore" "minimal-techno" "movies" "mpb" "new-age" "new-release" "opera" "pagode" "party" "philippines-opm" "piano" "pop" "pop-film" "post-dubstep" "power-pop" "progressive-house" "psych-rock" "punk" "punk-rock" "r-n-b" "rainy-day" "reggae" "reggaeton" |
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
request.url.split('?')[0].includes('.svg') && response.setHeader('Content-Type','image/svg+xml') | |
request.url.split('?')[0].includes('.css') && response.setHeader('Content-Type','text/css') |
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
const mysql = require('mysql') | |
const config = ini.parse(fs.readFileSync('../credentials.ini', 'utf-8')) /* only happens once on server start */ | |
const db = mysql.createPool(config.labsdb) | |
tryMySQL(input){ | |
return new Promise((resolve, reject) => { | |
if(!input.mysql) return resolve(input) | |
db.getConnection((err, conn) => { | |
if(err) reject({dbError: err}) |
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
## For Python 2 | |
# import codecs | |
# from future.utils.surrogateescape import register_surrogateescape | |
# register_surrogateescape() | |
## Python 2 doesn't have an errors parameter in its global 'open' method, so, import codecs and use codecs.open | |
# with codecs.open('./youtube_quils_results.csv','r', encoding="utf-8", errors="surrogateescape") as the_file: | |
with open('./youtube_quils_results.csv','r', encoding="utf-8", errors="surrogateescape") as the_file: | |
original = pandas.read_csv(the_file, iterator=True, encoding="utf-8") | |
unsafe_set = set(pandas.read_csv('unsafe_list.csv', header=None, squeeze=True)) |
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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Controller : MonoBehaviour | |
{ | |
public string selection; | |
// Use this for initialization | |
void Awake() |
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
#!/usr/local/bin/node | |
var net = require('net') | |
var util = require('util') | |
var os = require('os') | |
var port = process.env.CSPORT || 1024 | |
var host = process.env.CSHOST || 'localhost' | |
var identity = process.env.USER || 'unknown' /* not to be confused with 'nobody' */ | |
var botname = process.env.BOT || 'harry' |
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
pkg install node | |
pkg install www/npm | |
pkg install git | |
git clone https://github.com/jazzyjackson/MIXINTvNegative3.git | |
cd MIXINT | |
npm install |