Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
// NOTE: This utility is for illustration purposes | |
// Allows to calculate minimal hash length based on the number of files to consider | |
// MD5 uses 16 symbols | |
enum EConstant { | |
NumberOfSymbols = 16, | |
HashStringLength = 32, // MD5 hash length | |
DefaultProbabilityThreshold = 0.01, | |
BinarySearchFactor = 1.5, | |
} |
Require Import Arith. | |
(* define the function that calculates t1 and t2 *) | |
Fixpoint calc_t1 (m: nat) (l: list nat) : nat := | |
match l with | |
| [] => 1 | |
| h :: t => h * calc_t1 m t | |
end * m - 1. | |
Fixpoint calc_t2 (m: nat) (l: list nat) : nat := |
const decorateWithNumber = <T>(p: T): T & { num: number } => ({ ...p, num: 10 }); | |
const decorateWithBoolean = <T>(p: T): T & { bool: boolean } => ({ ...p, bool: true }); | |
const decorateWithString = <T>(p: T): T & { str: string } => ({ ...p, str: 'string' }); | |
const removeNumberDecoration = <T>({ num, ...rest }: T & { num?: number }): Omit<T, "num"> => ({ ...rest }); | |
const functions = [decorateWithBoolean, decorateWithNumber, decorateWithString, removeNumberDecoration] as const; | |
function pipe<A, B>(f1: (a: A) => B): (a: A) => B; | |
function pipe<A, B, C>(f1: (a: A) => B, f2: (a: B) => C): (a: A) => C; | |
function pipe<A, B, C, D>( |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
// Example of how types could be declared using TS interfaces | |
interface IEpisode { | |
title: string; | |
} | |
interface ICharacter { | |
name: string; | |
appearsIn: IEpisode[]; | |
} |
Require Import Coq.ZArith.ZArith. | |
Require Import Coq.ZArith.Znumtheory. | |
Require Import Coq.Sets.Ensembles. | |
Require Import Coq.Sets.Finite_sets. | |
Require Import Coq.PArith.BinPos. | |
Definition Z_ens := Ensemble Z. | |
Print Finite. | |
Print Empty_set. | |
Definition is_empty_set U A := forall x, ~(In U A x). |
x = np.array([[1, 1],[1, 2],[1, 3]]) ## must contain first column with one for theta bias | |
y = np.array([[4.5], [5.5], [8.5]]) | |
_x = np.dot(x.T, x) | |
xI = np.linalg.inv(_x) | |
n = np.dot(xI,x.T) | |
theta = np.dot(n, y) | |
print(theta) | |
print(theta[0], theta[0][0]) | |
print(x[0], x[0][0]) | |
y1_hat = theta[0][0] + theta[1][0]*x[0][1] |
StateSubject.subscribe((state) => render(<App state={state} />, rootElement)); |
const filterProducts = (event: IEvent, state: IState) => { | |
const value = event[2] || ""; | |
const filteredProducts = state.products | |
.filter(({ name }) => name.toLowerCase().includes(value.toLowerCase())) | |
.map(({ id }) => id); | |
return { | |
...state, | |
input: value, | |
productsToDisplay: filteredProducts | |
}; |
const reduce = ( | |
event: IEvent, | |
state: typeof initialState | |
): typeof initialState => { | |
if (event[0] === "change" && event[1] === "input-01") { | |
const value = event[2]; | |
const filteredProducts = state.products | |
.filter(({ name }) => name.toLowerCase().includes(value.toLowerCase())) | |
.map(({ id }) => id); | |
return { |