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 https://react-redux.js.org/api/hooks#using-memoizing-selectors | |
import { createSelector } from 'reselect' | |
// A Selector is just a fn from State to T | |
type Selector<T> = (state: State) => T; | |
const selectCompletedTodosCount = createSelector( // This utility does nothing you can't do easily without it | |
(state) => state.todos, | |
(_, completed) => completed, // Why would we do this? This is just a roundabout way of parameterizing a fn. |
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
curl https://raw.githubusercontent.com/brunoklein99/deep-learning-notes/master/shakespeare.txt | say |
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 Count<A, S extends 0[] = []> = A extends S["length"] | |
? S | |
: Count<A, [...S, 0]>; | |
type IncC<A> = [...Count<A>, 0]; | |
type DecC<A> = Count<A> extends [infer _H, ...(infer R)] ? R : []; | |
// Basic Arithmetic | |
type Inc<A> = IncC<A>["length"]; | |
type Dec<A> = DecC<A>["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 * as t from "io-ts"; | |
import * as R from "fp-ts/lib/Record"; | |
type AvroStringSchema = "string"; | |
type AvroNullSchema = "null"; | |
type AvroFieldSchema = { name: string; type: AvroSchema }; | |
type AvroRecordSchema = { | |
type: "record"; | |
namespace: string; | |
name: string; |
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 * as ts from "typescript"; | |
// Haven't dealt with arrays and records | |
type AvscType = "string" | "int" | "null"; | |
type TsTypes = | |
| ts.SyntaxKind.StringKeyword | |
| ts.SyntaxKind.NumberKeyword | |
| ts.SyntaxKind.NullKeyword; | |
interface AvscField { |
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
function fish_prompt | |
test $SSH_TTY; and printf (set_color red)(whoami)(set_color white)'@'(set_color yellow)(hostname)' ' | |
test $USER = 'root'; and echo (set_color red)"#" | |
# Main | |
echo -n (set_color cyan)(prompt_pwd)(set_color purple)(__fish_vcs_prompt) (set_color red)'❯'(set_color yellow)'❯'(set_color green)'❯ ' | |
end |
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 urllib2 | |
from bs4 import BeautifulSoup | |
PAGES_TO_SCRAPE = 10 | |
# Get HTML for all deck listing pages | |
htmls = [] | |
for x in range(PAGES_TO_SCRAPE): | |
print "SCRAPING PAGE " + str(x + 1) |
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
git config --global alias.history "log --follow --stat" |
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
USAGE = \ | |
""" | |
Searches an XCode project to determine which image | |
assets aren't being used then removes them. | |
WARNING: This will delete things permanently if your | |
project is not under source control. | |
""" | |
import os |
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
require 'chunky_png' | |
include ChunkyPNG::Color | |
images = [ChunkyPNG::Image.from_file('dog1.png'), # Put yr files here | |
ChunkyPNG::Image.from_file('dog2.png')] | |
output = ChunkyPNG::Image.new(images.first.width, images.last.height, rgb(255, 255, 255)) | |
height = images.first.height > images.last.height ? images.last.height : images.first.height | |
width = images.first.width > images.last.width ? images.last.width : images.first.width |
NewerOlder