Skip to content

Instantly share code, notes, and snippets.

View twavv's full-sized avatar

Travis DePrato twavv

View GitHub Profile
@twavv
twavv / README.md
Last active March 1, 2021 23:47
Download these two files.

Assuming you've downloaded kernel.json,

DEST="$(jupyter --data-dir)/kernels/poetry"
mkdir -p "$DEST"
cp kernel.json "$DEST"

# Feel free to copy this to wherever, just change the line in kernel.json
chmod +x poetry-kernel.sh
sudo cp poetry-kernel.sh /usr/local/bin/
@twavv
twavv / RTK-example-API.ts
Last active November 19, 2019 17:27
Redux Toolkit TS Example API
import { Reducer } from "redux";
import {
createAction,
createReducer,
PayloadAction,
PayloadActionCreator,
} from "@reduxjs/toolkit";
const fetchUserBlogPosts = createAction<{
userId: number;
@twavv
twavv / backspaceplugin.js
Last active August 16, 2019 18:51
Slate Inline Focus Hack
import {
LATEX_INLINE_NODE_TYPE,
} from "../schema";
export const LatexInlineBackspacePlugin = () => ({
/**
* Handle key down when we're on the right edge of a `latexinline`.
* @param event
* @param editor
* @param next
@twavv
twavv / blink-interact-sum-example.jl
Last active July 24, 2019 15:20
Blink.jl/Interact.jl Example
interface Address {
lineOne: string;
lineTwo: string | undefined;
city: string;
}
type AddressWithOptionalProperties = UndefinedOptional<Address>;
const address: Address = {
lineOne: "1234 Main St.",
// lineTwo is required in this interface
@twavv
twavv / undefined-optional.ts
Last active June 16, 2019 06:16
Typescript making undefined properties optional
/**
* Get the keys of the properties to which U can be assigned.
*/
type AssignableKeys<T, U> = {
[K in keyof T]: U extends T[K] ? K : never
}[keyof T];
/**
* Get the interface containing only properties to which undefined can be assigned.
*/
FROM krallin/ubuntu-tini:16.04
ENV DEBIAN_FRONTEND=noninteractive \
DEBCONF_NONINTERACTIVE_SEEN=true \
SHELL=/bin/bash \
NB_USER=nbuser \
NB_UID=1000 \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8
RUN apt-get update && \
import * as Slate from "slate";
const enum SchemaViolation {
CHILD_OBJECT_INVALID = "child_object_invalid",
CHILD_REQUIRED = "child_required",
CHILD_TYPE_INVALID = "child_type_invalid",
CHILD_UNKNOWN = "child_unknown",
FIRST_CHILD_OBJECT_INVALID = "first_child_object_invalid",
FIRST_CHILD_TYPE_INVALID = "first_child_type_invalid",
LAST_CHILD_OBJECT_INVALID = "last_child_object_invalid",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.