Skip to content

Instantly share code, notes, and snippets.

import { Prisma } from "@prisma/client";
type PrismaError =
| Prisma.PrismaClientKnownRequestError
| Prisma.PrismaClientUnknownRequestError
| Prisma.PrismaClientRustPanicError
| Prisma.PrismaClientInitializationError
| Prisma.PrismaClientValidationError;
export const catchPromiseErrors = async <E, T>(promise: Promise<T>): Promise<[T, null] | [null, E]> => {
@davidpfahler
davidpfahler / ocr.sh
Created September 26, 2021 18:28
OCR PDF file (aka make it searchable) using tesseract (super hacky, use at your own risk!)
#!/bin/sh
mkdir -p __searchable__
y="`pwd`/$1"
echo Will create a searchable PDF for $y
x=`basename "$y"`
name=${x%.*}
@davidpfahler
davidpfahler / how_to_train_your_resnet_fastaiv1.ipynb
Last active September 24, 2019 13:59
Attempt to reproduce baseline using memory-cached dataset
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidpfahler
davidpfahler / how_to_train_your_resnet_fastaiv1.ipynb
Created September 24, 2019 07:54
Attempt to reproduce Part 1: Baseline of "How to train your resnet" with fastai v1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidpfahler
davidpfahler / reproduce_original_how_to_train_your_resnet.ipynb
Created September 24, 2019 07:51
Reproduce Part 1: Baseline of "How to train your resnet"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidpfahler
davidpfahler / how_to_train_your_resnet_fastaiv1.ipynb
Created September 15, 2019 21:11
how_to_train_your_resnet_fastaiv1.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidpfahler
davidpfahler / LM06_cuda_cnn_hooks.ipynb
Last active July 26, 2019 13:47
fastai Deep Learning Part 2 Lesson 10 - experiments with gradient inspection
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const fs = require('fs')
const path = require('path')
const colors = require('colors/safe')
const webpack = require('webpack')
const WebpackBuildNotifierPlugin = require('webpack-build-notifier')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const compact = require('lodash.compact')
const without = require('lodash.without')
// This webpack config does not only support two different entry points
@davidpfahler
davidpfahler / component.js
Last active June 15, 2016 12:55
Passing select props to child component with feross/standard
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "^_$" }]*/
import React, { Component } from 'react'
import Child from '../components/Child'
class ParentContainer extends Component {
componentDidMount () {
this.fetchData()
}
fetchData () {
// this.props.receiveData is a Redux prebound action creator
@davidpfahler
davidpfahler / alternative1.js
Last active December 8, 2015 19:23
Alternative Redux API suggestions without action constants using only functions
import { createStore } from 'redux'
let increment = (state = 0, x) => { return state + x }
let decrement = (state = 0, x) => { return state - x}
let store = createStore([increment, decrement])
store.subscribe(() =>
console.log(store.getState())
)