Skip to content

Instantly share code, notes, and snippets.

class stackify(object):
"""Wrapper for stack-based recursion with memoisation
When the function is called and argument is not in cache, push it to stack
Attempt to call the function on the arguments in the stack such that an
exception is raised if the function tries to recurse. In that case, add the
function argument to the stack and continue
The order of successful arguments also provides a topological sort
@dfee
dfee / README.md
Created April 27, 2018 01:16
manifest_vk: convert **kwargs to explicit keyword arguments

Python: make explicit variable keywords in a function's signature

Python functions can take a variable keyword parameter, often known as **kwargs.

def myfunc(**kwargs):
    print(kwargs)

> myfunc(a=1, b=2)
{'a': 1, 'b': 2}
@dfee
dfee / README.md
Last active April 27, 2018 09:04
Signature 2

signature pt. 2

consideration:

  • optional is a validator / converter in attrs
  • is Missing appropriate here? ... it is handled as a default param for inspect.Parameter
  • naming of constructors: sig.arg(), sig.args, sig.kwarg, sig.kwargs()
  • ... and package signature
  • should sig.args be passed out as args, kwargs, or is this an option for end users?

next:

Keybase proof

I hereby claim:

  • I am dfee on github.
  • I am dfee (https://keybase.io/dfee) on keybase.
  • I have a public key ASC0E1cJpr9CJuyKtMmAVBusRIYT8HnmxIhUHRxeUWy5wAo

To claim this, I am signing this object:

[tool.poetry]
name = "barry.rpc"
version = "2018.0.0"
description = "mypkg rpc module"
authors = ["Devin Fee <dev...>"]
packages = [
{ include = "mypkg" },
]
[tool.poetry.dependencies]
[tool.poetry]
name = "demo"
version = "0.1.0"
description = ""
authors = ["Devin Fee"]
[tool.poetry.dependencies]
python = "*"
[tool.poetry.dev-dependencies]
const marked = require("marked");
module.exports = (nextConfig = {}) => {
return Object.assign({}, nextConfig, {
webpack(config, options) {
config.module.rules.push({
test: /\.(html)$/,
use: {
loader: "html-loader",
options: {
import asyncio
import enum
import inspect
import typing
import graphql
import pytest
class MutationEnum(enum.Enum):
@dfee
dfee / Button.mdx
Last active January 11, 2019 00:56
SimplePropsTable for `docz`
name
Button

Properties

<SimplePropsTable props={{ color: { required: false,

@dfee
dfee / bidirectional-react-type.tsx
Last active January 18, 2019 23:01
map React.ReactType -> ElementType -> React.ReactType
/**
* type MyType = "table" // a keyof JSX.IntrinsicElements
* type MyTypeElementType = ElementTypeFromReactType<MyType>; // => HTMLTableElement
* type MyType2 = ReactTypeFromElementType<MyTypeElementType>; // => "table"
**/
import * as React from 'react';
/**
* Map a React.ReactType "T" to it's real type: