I hereby claim:
- I am ericzakariasson on github.
- I am ericzakariasson (https://keybase.io/ericzakariasson) on keybase.
- I have a public key ASDg4R4fDXl7r9wg4R6nUyXzFCcyi0kqkPVHIrP0exvj3wo
To claim this, I am signing this object:
import Head from "next/head"; | |
import { useRouter } from "next/router"; | |
type SeoProps = { | |
title?: string; | |
description?: string; | |
image?: string; | |
}; | |
const defaultProps: Required<Pick<SeoProps, "description" | "image">> = { |
[ | |
{ | |
"title": "500px", | |
"slug": "500px", | |
"colors": [ | |
"0099e5", | |
"ff4c4c", | |
"34bf49" | |
], | |
"brand_url": "https://500px.com/" |
I hereby claim:
To claim this, I am signing this object:
describe("withRetry", () => { | |
it("should retry if when condition is true", async () => { | |
const fn = jest | |
.fn() | |
.mockImplementationOnce(() => { | |
throw new Error("Should throw"); | |
}) | |
.mockImplementationOnce(() => 1); | |
let retryCount = 0; |
export enum TextInputTypes { | |
Raw, | |
Parameter, | |
} | |
export type Primitive = string | number | boolean; | |
export interface TextInputObject<Type extends TextInputTypes> { | |
type: Type; | |
value: Primitive; |
class InternalError extends Error {} | |
type Predicate<T> = (item: T) => boolean; | |
function single<T>(array: T[], predicate?: Predicate<T>) { | |
const items = predicate ? array.filter(predicate) : array; | |
if (items.length !== 1) { | |
throw new InternalError("Array does not contain exactly one item"); | |
} |
import { act, renderHook } from "@testing-library/react-hooks"; | |
import { useArray } from "./useArray"; | |
describe("useArray", () => { | |
describe("props", () => { | |
it("should have initial state", () => { | |
const { result } = renderHook(() => | |
useArray({ | |
initialState: ["a", "b", "c"], |
def matrix_multiplication(a, b): | |
if len(b) == 0 or len(a) == 0: | |
return [] | |
c = [] | |
for i in range(len(a)): | |
c.append([]) | |
for j in range(len(b[0])): | |
c[-1].append(0.0) |
import React, { useCallback, useEffect, useRef, useState } from 'react' | |
// Types to be shared with frontend and backend | |
interface ApiResponseInfo { | |
code: number | |
message: string | |
[key: string]: unknown | |
} | |
interface ApiResponseCommon { |
/* | |
Guven an island with the shape of this: | |
__ | |
__|__| __ | |
__ |__|__| __ __|__| | |
|__| __|__|__|__|__| |__|__|__ | |
|__|__|__|__|__|__|__|__ __ |__|__|__|__ | |
__|__|__|__|__|__|__|__|__|__|__|__|__|__|__|__| | |
[0, 3, 1, 2, 4, 5, 2, 3, 1, 0, 1, 0, 3, 4, 2, 1] => 18 |