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 request = require('request-promise'); | |
var highland = require('highland'); | |
var promiseToStream = highland; | |
var arrayToStream = highland; | |
var pollerToStream = highland; | |
function eventTime(event) { | |
return new Date(event.createdAt).getTime(); | |
} |
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
listen: | |
port: 443 | |
ssl: | |
certificate-file: /tmp/h2o/localhost.crt | |
key-file: /tmp/h2o/localhost.key | |
hosts: | |
"localhost": | |
paths: | |
"/": |
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
equal(alert, {foo: 1, bar: 2}, "Function is not a dict") | |
1. Function is not a dict, expected: { | |
"foo": 1, | |
"bar": 2 | |
} result: function alert(){ | |
[code] | |
} |
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
"""Ban some modules from being importable inside the context | |
For example: | |
with missing_modules("sys"): | |
try: | |
import sys | |
except ImportError: | |
print "sys not found" |
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
"use strict"; | |
var highland = require("highland"); | |
var request = require("request-promise"); | |
var cowsay = require("cowsay"); | |
var promiseToStream = highland; | |
var arrayToStream = highland; | |
var pollerToStream = highland; | |
function cowPageGenerator(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
"use strict"; | |
var highland = require("highland"); | |
var request = require("request-promise"); | |
var promiseToStream = highland; | |
var arrayToStream = highland; | |
var pollerToStream = highland; | |
function cowPageGenerator(url) { | |
var page = 1; |
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 highland = require('highland'); | |
const request = require('request-promise') | |
const promiseToStream = highland; | |
const arrayToStream = highland; | |
const pollerToStream = highland; | |
function cowPageGenerator(url) { | |
let page = 1; | |
return (push, next) => { | |
push(null, request(url, {qs: {page: page++}})); |
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 request = require('request-promise'); | |
const highland = require('highland'); | |
const promiseToStream = highland; | |
const arrayToStream = highland; | |
const pollerToStream = highland; | |
function seenRecently(timeGetter, mostRecentTime=0) { | |
return (e) => { | |
let then = timeGetter(e).getTime(); |
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 fs = require("fs"); | |
var Bacon = require("baconjs"); | |
var lifestyle = require("lifestyle"); | |
var root = "https://api.finn.no/iad/" | |
var adListPath = "adids.txt"; | |
var client = new lifestyle.FinnClient(root); | |
function fetchAd(id) { |
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
// launch.js | |
var traceur = require('traceur'); | |
traceur.require('site.js'); | |
// site.js | |
var express = require('express'); | |
var app = express(); | |
app.get('/', (req, res) => res.send(getSalutation(req.query.name))); |