Skip to content

Instantly share code, notes, and snippets.

View ianchanning's full-sized avatar

Ian Channing ianchanning

View GitHub Profile
@YBogomolov
YBogomolov / tf.ts
Last active January 13, 2025 09:23
Tagless Final example with fp-ts
import { HKT, Type, URIS } from 'fp-ts/lib/HKT';
import { identity, Identity, URI } from 'fp-ts/lib/Identity';
import { Monad, Monad1 } from 'fp-ts/lib/Monad';
// Task: get all users named 'John' and make them admins
interface User {
id: number;
name: string;
age: number;
@tcvieira
tcvieira / setupFastaiV1.md
Last active October 12, 2021 13:10
Setup Fast.ai v1 on Paperspace Fast.ai Template

Setup Fastai v1 on Paperspace

Machine

  • Create a Fast.ai machine from public templates w/ P4000 and public IP

Connect to the machine

  • $ source deactivate fastai
  • $ pip install virtualenv
@rxwei
rxwei / ad-manifesto.md
Last active December 6, 2024 16:54
First-Class Automatic Differentiation in Swift: A Manifesto
@cvburgess
cvburgess / SQLCache.js
Created August 28, 2018 02:23
Knex - caching
const { InMemoryLRUCache } = require("apollo-server-caching");
class SQLCache {
constructor(cache = new InMemoryLRUCache()) {
this.cache = cache;
}
async knexPlugin(knexThen, ctx, args) {
const isSelectStatement = ctx._method === "select";
@cvburgess
cvburgess / SQLCache.js
Created August 28, 2018 02:13
Knex - caching and batching
const { InMemoryLRUCache } = require("apollo-server-caching");
const DataLoader = require("dataloader");
class SQLCache {
constructor(cache = new InMemoryLRUCache(), knex) {
this.cache = cache;
this.loader = new DataLoader(queries =>
Promise.all(queries.map(query => knexInstance.raw(query)))
);
}
@endolith
endolith / DFT_ANN.py
Last active October 6, 2025 09:06
Training neural network to implement discrete Fourier transform (DFT/FFT)
"""
Train a neural network to implement the discrete Fourier transform
"""
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
N = 32
batch = 10000
@rusty-key
rusty-key / index.re
Created July 5, 2018 07:17
Reason HMR
[@bs.val] [@bs.scope ("module")]
external isHotEnabled : bool = "hot";
[@bs.val] [@bs.scope ("module", "hot")] external hotAccept : unit => unit = "accept";
ReactDOMRe.renderToElementWithId(<App />, "root");
if (isHotEnabled) {
hotAccept();
}
@vladbat00
vladbat00 / parcel-node-target-hotreload.js
Created May 9, 2018 13:36
Parcel bundler for hotreloading node.js target. Start with `run` argument in order get your index.js running after each rebuild
const Bundler = require('parcel-bundler');
const childProcess = require('child_process');
const file = 'index.js';
const options = {};
const bundler = new Bundler(file, options);
const runBundle = process.argv.includes('run');
let bundle = null;
@adcreare
adcreare / npm-beta-publish.md
Last active March 26, 2025 16:15
npm publish a beta package

Steps to publish a npm package to beta that won't be available via latest and won't auto install on ncu updates etc

  1. Ensure any compile is run npm run dist etc
  2. Modify version in package.json to the following format (match with existing verion numbers etc) "version": "0.1.120-beta.1" where beta.x is the number of those betas
  3. Publish to npm npm publish --tag beta

There are two options for install:

  • Always install beta with npm install packagename@beta
  • Install specific version with npm install [email protected]
@trueadm
trueadm / adopt-syntax.js
Last active November 27, 2021 03:32
Adding a the "adopt" keyword to the JSX syntax
// I'm suggesting we add a new "adopt X from <Y />" syntax to the JSX language
// it would de-sugar to render prop children, but look and read better than
// what we currently have. For example:
// 1.
// this sugar
function MyComponent(props) {
adopt foo from <Bar />;
return <div>{foo}</div>;
}