This example shows how to take the output of a RethinkDB changefeed and send it to Plottico, a microservice that generates embeddable streaming graphs. This example uses Plottico's hosted infrastructure, but you can also self-host your own Plottico server using the code from Plottico's GitHub repository.
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
<html> | |
<head> | |
<title>HTML5 Photo Booth</title> | |
</head> | |
<body> | |
<h2>HTML5 Photo Booth</h2> | |
<video id="live" autoplay></video> | |
<canvas id="snapshot" style="display:none"></canvas> | |
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
package main | |
import ( | |
"code.google.com/p/gcfg" | |
"fmt" | |
r "github.com/dancannon/gorethink" | |
irc "github.com/fluffle/goirc/client" | |
"log" | |
"strings" | |
) |
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 Markdoc = require('@markdoc/markdoc'); | |
const example = ` | |
{% definition-list %} | |
{% definition term="this is the term" %} | |
This is the definition | |
{% /definition %} | |
{% definition term="another term" %} |
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/bin/env python | |
from csvkit.convert.js import json2csv | |
from collections import OrderedDict | |
from flask import Flask | |
import rethinkdb as r | |
import json, StringIO | |
config = { | |
"port": 8096, |
I recently began experimenting with async iterators, using the --harmony
flag in Node 9.5. After reading through the MDN docs, I figured that it might be interesting to make a function that takes the values yielded by an async generator function and serves them as an SSE event stream. The following is a simple, contrived example:
const http = require("http");
const timer = time =>
new Promise(resolve => setTimeout(resolve, time));
async function* counter() {
let counter = 0;
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 http = require("http"); | |
const https = require("https"); | |
const isRemote = path => | |
path.startsWith("http://") || path.startsWith("https://"); | |
const protocol = url => | |
url.startsWith("https://") ? https : http; | |
const fetch = url => |
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/bin/env python | |
import SimpleHTTPServer | |
from gwibber import microblog, config | |
from mako.template import Template | |
PORT = 10002 | |
def generate_html(messages): | |
return Template(""" |
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
var DSServer = require("deepstream.io"); | |
var DSRethinkConnector = require("deepstream.io-storage-rethinkdb"); | |
var server = new DSServer(); | |
server.set("host", "localhost"); | |
server.set("port", 6020); | |
server.set("storage", new DSRethinkConnector({ | |
port: 28015, | |
host: "localhost", |
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
<html> | |
<head> | |
<script type="text/javascript" src="//npmcdn.com/@reactivex/rxjs@5.0.0-beta.9/dist/global/Rx.umd.js"></script> | |
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.10.3/babel.min.js"></script> | |
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/react/15.2.0/react.min.js"></script> | |
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/react/15.2.0/react-dom.min.js"></script> | |
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script> | |
<script type="text/javascript" src="/horizon/horizon.js"></script> | |
<script type="text/babel" src="views.js"></script> |
NewerOlder