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
from typing import ( | |
Any, | |
Dict, | |
Generic, | |
Literal, | |
Optional, | |
Tuple, | |
TypeVar, | |
) | |
from wireup import DependencyContainer, container |
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
#!/bin/zsh | |
# Conditionally pass line or file data to jq. | |
# | |
# First argument is a filter override to jq, default is '.' | |
# Second argument is a file, otherwise stdin is used | |
JQ_FILTER=${1:-'.'} | |
while read line |
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
import cli, { InputQuestion, ListQuestion } from "inquirer"; | |
interface TypeSafeInput< | |
TValidatedInput, | |
TName extends string | |
> extends InputQuestion<{ [name in TName]: TValidatedInput }> { | |
type: "input"; | |
name: TName; | |
message: string; | |
typePredicate: (input: any) => input is TValidatedInput; |
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
type KEY = string | number | symbol; | |
interface Dictionary<K extends KEY, V> { | |
getKeys(): K[]; | |
getValues(): V[]; | |
get(key: K): V | null; | |
put(key: K, val: V): void; // or boolean? | |
} | |
class JSDict<K extends KEY, V> implements Dictionary<K, V> { |
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
version: "2" | |
services: | |
app: | |
image: crccheck/hello-world | |
restart: always | |
networks: | |
- web | |
- default | |
expose: |
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
// CLIENT | |
import feathers from '@feathersjs/feathers' | |
import socketio from '@feathersjs/socketio-client' | |
import auth from '@feathersjs/authentication-client' | |
import io from 'socket.io-client' | |
const socket = io('http://localhost:3030') | |
const app = feathers() | |
// Set up Socket.io client with the socket |
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
class ContinueOnSuccess { | |
items = []; | |
length = 0; | |
constructor(newItems) { | |
this.items = newItems; | |
length = this.items.length; | |
} |
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
import { curry } from 'lodash'; | |
export type Predicate = () => boolean; | |
export type Func<a> = () => a; | |
export interface ThenElse<T = void, E = T> { | |
t: Func<T>, | |
e: Func<E> | |
} |
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
import { curry, flowRight as compose } from 'lodash'; | |
const Task = require('folktale/concurrency/task'); | |
/* example code, pieces from application */ | |
/* Imagine a functional-progrmaming style Forgot Password workflow */ | |
usernameOrEmailExists = (input: {/*...*/}) => isValid(input) | |
? Task.of(input.username) | |
: Task.rejected('Invalid'); |
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 crypto = require('crypto'); | |
const util = require('util'); | |
const curry = require('lodash/curry'); | |
const compose = require('lodash/flowRight'); // alias flowRight as compose | |
const moment = require('moment'); | |
const Task = require('folktale/concurrency/task'); | |
const { fromPromised, waitAll } = require('folktale/concurrency/task'); | |
// isValidForgotPasswordRequest :: ForgotPasswordInput -> boolean |
NewerOlder