This file contains hidden or 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 is_exec = (value) => { | |
| return Array.isArray(value) && (typeof value[0] === 'string') && value[0].startsWith('@'); | |
| }; | |
| const flatten = (...css) => | |
| css.reduce((acc, group) => acc.concat(group), []); | |
| const exec = (refs, [predicate, ...args]) => { | |
| const core = { | |
| '@': (name) => refs[name], |
This file contains hidden or 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
| size=3 | |
| blocks = { | |
| {x=10, y=10} | |
| } | |
| apples = { | |
| {x=11,y=11} | |
| } |
This file contains hidden or 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 CLIENT_ID = ... | |
| // const CALLBACK_URL = ... |
This file contains hidden or 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 canvas = canvasRef.current; | |
| const pixelRatio = window.devicePixelRatio || 1; | |
| const rect = canvas.getBoundingClientRect(); | |
| canvas.style.width = rect.width + 'px'; | |
| canvas.style.height = rect.height + 'px'; | |
| canvas.width = rect.width * pixelRatio; | |
| canvas.height = rect.height * pixelRatio; |
This file contains hidden or 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 search = (nums, target) => { | |
| let start = 0; | |
| let end = nums.length - 1; | |
| while (start <= end) { | |
| let mid = Math.floor((end + start) / 2); | |
| if (nums[mid] === target) { | |
| return mid; | |
| } |
This file contains hidden or 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 getDispatcher = () => { | |
| return (React as any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current; | |
| }; | |
| const setDispatcher = (w: any) => { | |
| (React as any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current = w; | |
| }; | |
| const useForceUpdate = ([v, setv] = useState(false)) => |
This file contains hidden or 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
| [ | |
| {"url":"https://feeds.megaphone.fm/newheights"}, | |
| {"url":"https://vas3k.club/posts.rss"}, | |
| {"url":"https://feeds.feedburner.com/abseilio"}, | |
| {"url":"https://www.astronet.ru/db/rss.xml"}, | |
| {"url":"https://ciechanow.ski/atom.xml"}, | |
| {"url":"http://ithare.com/feed/"}, | |
| {"url":"https://xkcd.com/rss.xml"}, | |
| {"url":"https://nuancesprog.ru/feed/"}, | |
| {"url":"https://tproger.ru/feed"}, |
This file contains hidden or 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 React from 'react'; | |
| import { Relative, Absolute, Clickable } from '../components/atoms'; | |
| const DropContext = React.createContext(null); | |
| const useDrop = () => React.useContext(DropContext); | |
| // If you don't want some kind of effect | |
| // to depend on a callback but wnat the | |
| // freshest version of a callback to be | |
| // available, this one is fo you |
This file contains hidden or 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
| export type Image = HTMLImageElement; | |
| const loadImage = async (url: string) => new Promise<Image>((resolve, reject) => { | |
| const img = new Image(); | |
| img.onload = () => resolve(img); | |
| img.onerror = (e) => reject(e); | |
| img.src = url; | |
| }); |
This file contains hidden or 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 observable = (predicate) => (listener) => predicate(listener); | |
| const pipe = (obs) => (...operators) => operators.reduce((acc, op) => op(acc), obs); | |
| const map = (mapper) => (obs) => observable((resolve) => obs((data) => resolve(mapper(data)))); | |
| const mergeMap = (mapper) => (obs) => observable((resolve) => obs((data) => mapper(data)(resolve))) | |
| const filter = (predicate) => (obs) => observable((resolve) => obs((data) => predicate(data) && resolve(data))); | |
| // { |
NewerOlder