Skip to content

Instantly share code, notes, and snippets.

It's a beautiful morning in Sunny California. It always is, except for the days which are terrible, during which everybody is so into the novelty of misery that they remark to one another about how happy they are for _something different_.
Dr. Striker steps out of her beat up silver Honda Odyssey and squints miserably into the rain. It plasters her hair to her face, bringing out her characteristic twisted expression of "nature makes me miserable".
"That was a great acid kinky sex party last night", thinks Dr. Striker.
Walking down the street, a car zooms by, kicking up a wave of clean water (the feces were washed away during the first few hours of rain last night). The water crests and splashes right onto a homeless person, sitting with all their stuff in plastic bags. The deluge hits them, and they look up at Dr. Striker as she passes.
The person's mouth is open, eyes creased shut. Wheezing. Are they crying? Laughing? Are those tears, or is it rain, both? Are they totally tripping out, or in rapture... d
@Jonahss
Jonahss / multiple-pipe.js
Created March 5, 2019 06:40
multiple-piping-is-concatenated
let streamify = require('stream-generators')
let infiniteWordStream = (word) => {
return streamify(function*() {
for (let i = 0; i < 1000; i++)
yield word
})
}
infiniteWordStream('1').pipe(process.stdout)
@Jonahss
Jonahss / test.js
Created May 25, 2018 21:48
uncertain-await
async function main () {
for (let i = 0; i < 100; i++) {
console.log(i)
await new Promise(() => {})
}
}
main()
@Jonahss
Jonahss / main.cs
Last active March 31, 2018 23:21
Redis AddToList
using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Redis;
using ServiceStack.DataAnnotations;
var redisManager = new RedisManagerPool("localhost:6379");
var redis = redisManager.GetClient();
// let's make sure this key doesn't exist first
console.log('alert')
[HTTP] --> GET /wd/hub/session/bed650fd-90ec-401e-9a75-f4a0e766bdb6/location
[MJSONWP] Calling AppiumDriver.getGeoLocation() with args: ["bed650fd-90ec-401e-9a75-f4a0e766bdb6"]
[debug] [iOS] Executing iOS command 'getGeoLocation'
[HTTP] <-- GET /wd/hub/session/bed650fd-90ec-401e-9a75-f4a0e766bdb6/location 501 3 ms - 122
@Jonahss
Jonahss / gist:6ebee30b8b443f51ae86
Last active December 15, 2015 01:14
Simple Appium Script: local, ios, safari
var wd = require('wd')
var remote = wd.remote('localhost', 4723)
var caps = {
"deviceName": "iPhone Simulator",
"browserName": "Safari",
"platformVersion": "8.2",
"platformName":"iOS",
"newCommandTimeout": 100000,
@Jonahss
Jonahss / event.js
Created August 27, 2015 19:20
promisify event listeners
'use strict'
let fs = require('fs');
let B = require('bluebird');
let readStream = fs.createReadStream(__filename)
readStream.on('close', function() {
console.log('regular close cb called')
})
// the xcode 6 simulators are really annoying, and bury the main app
// directories inside directories just named with Hashes.
// This function finds the proper directory by traversing all of them
// and reading a metadata plist (Mobile Container Manager)to get the
// bundle id.
async getAppDataDir (bundleId) {
if (await this.isFresh()) {
log.info('Attempted to get an app path from a fresh simulator ' +
'quickly launching the sim to populate its directories');
var targetWindow = UIATarget.localTarget().frontMostApp().mainWindow();
var targetApp = UIATarget.localTarget();
var interval = 1000; //ms interval to repeat
var wait = 5; //seconds to wait
var tapLocation = {x: 300, y: 300};
var future = new Date();
future.setSeconds(future.getSeconds()+wait);