Skip to content

Instantly share code, notes, and snippets.

@Droogans
Droogans / examplerun.ts
Last active August 21, 2021 01:34
yieldable-json in typescript
View examplerun.ts
import fs from 'fs';
import path from 'path';
import {parseAsync} from './yieldable-json';
(async () => {
const jsonFileLocation: string = process.argv.slice(-1)[0] as string;
const jsonFilePath = path.resolve(process.cwd(), jsonFileLocation);
let result;
for await (const fragment of parseAsync(await fs.promises.readFile(jsonFilePath))) {
@Droogans
Droogans / conftest.py
Created February 8, 2019 19:59
This is as close to abusing the fixture pattern as I would ever like to get, but it was needed in a hurry and it got rid of a lot of duplicate code.
View conftest.py
from itertools import chain, starmap
import pydash
import pytest
@pytest.fixture
def response(test_request):
"""
Use after calling the `test_request` fixture. Provides the resulting api request response object(s).
"""
@Droogans
Droogans / bill.spec.js
Last active November 6, 2015 10:43
Exercising the buffalo module.
View bill.spec.js
var _ = require('lodash'); // gotta use lodash for everything
var bill = require('buffalo');
var events = bill.events;
var conditions;
var victim;
/**
* TODO -- stop mixing promises and events, this API is really messed up.
*/
describe('suit construction', function () {
View pos_neg.py
def is_negative(number):
return number < 0
def pos_neg(a, b, negative):
if negative:
return a < 0 and b < 0
return len(set(map(is_negative, [a, b]))) > 1
View gist:9b39d4817d0fcacfc65c

FYI everyone, wait to merge anything further until we get 295 down

JUST STOP FORWARDING THE CHAIN EMAIL