This file contains hidden or 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 | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. |
This file contains hidden or 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 source = new EventSource('stream') | |
source.addEventListener('message', function (event) { | |
console.log('new message', event.data) | |
}, false) | |
// this is our custom event | |
source.addEventListener('connecttime', function (event) { | |
console.log('Connection was last established at: ' + event.data) | |
}, false) |
This file contains hidden or 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 http = require('http') | |
http.createServer(function (req, res) { | |
res.writeHead(200, { | |
'Content-Type': 'text/event-stream', | |
'Cache-Control': 'no-cache', | |
'Connection': 'keep-alive' | |
}) | |
res.write('retry: 10000\n') | |
res.write('event: connecttime\n') |
This file contains hidden or 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
'use strict' | |
const EventEmitter = require('events') | |
function ComputedModel (props) { | |
const base = Object.create(new EventEmitter()) | |
const keys = Object.keys(props) | |
for (let i = 0, len = keys.length; i < len; i++) { | |
const key = keys[i] | |
const prop = props[key] |
This file contains hidden or 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
// Welcome! require() some modules from npm (like you were using browserify) | |
// and then hit Run Code to run your code on the right side. | |
// Modules get downloaded from browserify-cdn and bundled in your browser. | |
const axios = require('axios') | |
axios.post('http://localhost:3000/login', {email: 'dev@scripto', pass: 'devpassword!'}).then((res) => { | |
const authToken = res.data.sessionId | |
const userUUID = res.data.key.split(':')[1] | |
const userURI = 'http://localhost:3000/user/'+userUUID | |
axios({method: 'get', headers: {'x-showrunner-auth': authToken}, url: userURI }).then((res) => console.log(res.data)).catch((err) => console.log(err)) | |
}).catch((err) => console.log(err)) |
This file contains hidden or 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
// params: | |
// * data:object | |
// * [key:string]?:string - a key/value pair. both must be strings. | |
function reduceHash (data) { | |
return Object.keys(data).reduce((acc, k) => { | |
acc.push.apply(acc, [k, data[k]]) | |
return acc | |
}, []) | |
} |
This file contains hidden or 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 pull = require('pull-stream') | |
const Notify = require('pull-notify') | |
const notify = Notify() | |
pull(notify.listen(), pull.drain(console.log)) | |
notify('hello', 'world') | |
notify.end() |
This file contains hidden or 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 choo = require('choo') | |
// app 1 | |
const app1 = choo() | |
app1.model({ | |
state: { | |
data: 'app1', | |
}, | |
reducers: { |
This file contains hidden or 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
1 1/2 cups cake flour | |
1/4 sugar | |
1/2 tsp salt | |
1/2 tsp baking soda | |
1/2 tsp baking powder | |
3/4 whole milk | |
3/4 whole milk yogurt | |
2 egg whites | |
4 tbls butter, melted | |
shot of vanilla extract |
This file contains hidden or 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
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
var history = require('sheet-router/history'); | |
var sheetRouter = require('sheet-router'); | |
var document = require('global/document'); | |
var href = require('sheet-router/href'); | |
var hash = require('sheet-router/hash'); | |
var hashMatch = require('hash-match'); | |
var sendAction = require('send-action'); | |
var mutate = require('xtend/mutable'); | |
var assert = require('assert'); |
NewerOlder