This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const iOSPreset = { | |
r1: 0.0586, | |
r2: 0.332, | |
}; | |
function getSmoothSquirclePath(w: number, h: number, r1: number, r2: number) { | |
r1 = Math.min(r1, r2); | |
return ` | |
M 0,${r2} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copy this code and paste it into Scriptable code editor on your phone | |
async function loadStats() { | |
const request = new Request("https://your-endpoint-giving-you-revenue-data.com"); | |
const { todayUSD, todayOrders, revenue30USD, orders30 } = await request.loadJSON(); | |
return { todayUSD, todayOrders, revenue30USD, orders30 }; | |
} | |
const usdFormatter = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Node, NodeSpec, AttributeSpec, ParseRule, Fragment, NodeType } from 'prosemirror-model'; | |
import { EditorState, Plugin } from 'prosemirror-state'; | |
import { Decoration, EditorView, NodeView } from 'prosemirror-view'; | |
import { ComponentType } from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { createGlobalStyle, css } from 'styled-components'; | |
/** | |
* Props for react component responsible for rendering node view | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Timpler", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"a": "cd ./android && ./gradlew app:assembleDebug && ./gradlew installDebug", | |
"android": "react-native run-android", | |
"ios": "react-native run-ios", | |
"start": "react-native start", | |
"test": "jest", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Test na mamę" | |
syn rozmawia z mamą o swojej aplikacji. | |
2 przykłady tej rozmowy, jedna w której syn oblewa "test na mamę" i druga w której zalicza. | |
W nawiasach są komentarza autora książki do tego co rozmawiają | |
syn: mamo, mam pomysł na biznes, mogę Ci o tym opowiedzieć? (mama myśli pewnie - o, mój synek! nie chce go urazić!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useRef } from 'react'; | |
const noValueSymbol = Symbol(); | |
function didBitsChange(oldBits: any[], newBits: any) { | |
return oldBits.some((oldBit, index) => !Object.is(oldBit, newBits[index])); | |
} | |
export function useSuspend<T>( | |
fetcher: () => Promise<T>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Goal: | |
* | |
* Being able to freeze some part of react tree and stop all updates from 'react word' for part of the tree for some period of time. | |
* It would prevent ui from updating in any way (props change, state change, hooks change etc) | |
* | |
* Use case: | |
* | |
* Let's say there is tab based react-native app. | |
* All of the screens are rendered all the time, and by using some store (redux etc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type AllowedArg = number | string | boolean | null | undefined; | |
function stringifyArg(arg: AllowedArg) { | |
return `${arg}`; | |
} | |
function serializeArgs(args: AllowedArg[]) { | |
const argsLimiter = "<<<<***>>>>"; | |
if (args.length === 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useRef } from 'react'; | |
export function useUnmountEffect(callback: () => void) { | |
const callbackRef = useRef(callback); | |
callbackRef.current = callback; | |
useEffect(() => { | |
return () => { | |
const callbackFunction = callbackRef.current; |
NewerOlder