Skip to content

Instantly share code, notes, and snippets.

View QuentinRoy's full-sized avatar

Quentin Roy QuentinRoy

View GitHub Profile
@QuentinRoy
QuentinRoy / flat-summarize.R
Last active September 16, 2017 10:39
A rewrite of ddply's summarize that 'flattens' named columns
# Fork of ddply's summarize that 'flattens' named columns
flat.summarize <- function (data, ...) {
stopifnot(is.data.frame(data) || is.list(data) || is.environment(data))
cols <- as.list(substitute(list(...))[-1])
if (is.null(names(cols))) {
missing_names <- rep(TRUE, length(cols))
}
else {
missing_names <- names(cols) == ""
}
@QuentinRoy
QuentinRoy / rxjs-from-stream.js
Created October 20, 2017 02:36
Transform a node stream into an rxjs Observer
import { Observable } from 'rxjs';
// Adapted from https://github.com/Reactive-Extensions/rx-node/blob/87589c07be626c32c842bdafa782fca5924e749c/index.js#L52
export default function fromStream(stream, finishEventName = 'end', dataEventName = 'data') {
stream.pause();
return new Observable((observer) => {
function dataHandler(data) {
observer.next(data);
}
declare module "javascript-state-machine" {
import { CamelCase } from "type-fest";
namespace StateMachine {
// Does not use a class type because it does not allow to produce instances
// whose members depend on the generic type parameters, e.g. using type
// union as we do here.
type Constructor = {
new <
TransitionName extends string,
{
"name": "zodios-test",
"version": "1.0.0",
"license": "ISC",
"packageManager": "^pnpm@7.24.3",
"dependencies": {
"@types/express": "^4.17.15",
"@zodios/core": "^10.7.1",
"@zodios/express": "^10.4.4",
"axios": "^1.2.2",