Skip to content

Instantly share code, notes, and snippets.

View sagartalla's full-sized avatar
:octocat:
Specialized in code repair

sagar talla sagartalla

:octocat:
Specialized in code repair
View GitHub Profile
@agiveygives
agiveygives / FunctionalComponent.jsx
Created April 25, 2019 01:34
Testing React State with Hooks, Jest, and Enzyme
import React from 'react';
const TestComponent = () => {
const [count, setCount] = React.useState(0);
return (
<h3>{count}</h3>
<span>
<button id="count-up" type="button" onClick={() => setCount(count + 1)}>Count Up</button>
<button id="count-down" type="button" onClick={() => setCount(count - 1)}>Count Down</button>
@OliverJAsh
OliverJAsh / foo.ts
Last active November 7, 2019 06:42
TypeScript URL helpers
import urlHelpers, { Url, UrlWithParsedQuery, UrlWithStringQuery } from 'url';
import queryStringHelpers from 'querystring';
import { Option } from 'funfix-core';
import pipe from 'lodash/flow';
import { ParsedUrlQuery } from 'querystring';
const isNonEmptyString = (str: string) => str.length > 0;
// https://github.com/gcanti/fp-ts/blob/15f4f701ed2ba6b0d306ba7b8ca9bede223b8155/src/function.ts#L127
const flipCurried = <A, B, C>(fn: (a: A) => (b: B) => C) => (b: B) => (a: A) =>
@vasanthk
vasanthk / System Design.md
Last active April 24, 2025 13:48
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?