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
export interface Fn<Args extends any[] = [], Result = void> { | |
(...args: Args): Result; | |
} | |
export type Getter<T> = Fn<[track: Track], T>; | |
export type Setter<T> = Fn<[value: T], void>; | |
export type Updater<T> = Fn<[reducer: Fn<[value: T], T>], void>; |
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 { Action } from '@reatom/core'; | |
export function isAction(arg: any): arg is Action<any> { | |
return arg && typeof arg === 'object' && typeof arg.type === 'string'; | |
} |
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 paths = declareAtom({}, on => [ | |
on(itemsAtom, (state, items) => { | |
const ims = values(items); | |
const paths = {}; | |
for (const id of ims) { | |
paths[id] = getPathForItem(id, items); | |
} | |
return paths; |
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 React, { FC } from 'react'; | |
import { useAtom } from '@reatom/react'; | |
import { declareAtom } from '@reatom/core'; | |
interface TreeNode { | |
id: string; | |
parentId: string | null; | |
name: string; | |
children: string[]; | |
properties: { |
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 { useContext, useEffect } from 'react'; | |
import { context } from '@reatom/react'; | |
export function useActionEffect(actionCreator, callback) { | |
const store = useContext(context); | |
useEffect(() => store.subscribe(actionCreator, () => callback()), [store, callback]); | |
} |
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 EFFECT = Symbol('@@Reatom/EFFECT'); | |
function createActionCreatorWithEffect(type, effect) { | |
return (payload) => ({ | |
type, | |
payload, | |
[EFFECT]: (store) => effect(payload, store), | |
}) | |
} |
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
<?php | |
declare(strict_types=1); | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
/** | |
* Class ApolloUpload |
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
<?php | |
/* Prototype file of PHP parser. | |
* Written by Masato Bito | |
* This file is PUBLIC DOMAIN. | |
*/ | |
$buffer = null; | |
$token = null; | |
$toktype = null; |
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 React, { Component } from 'react' | |
import validator from 'react-verificator' | |
const mapValidatorToProps = ({ ownProps, validator }) => ({ | |
validator | |
}) | |
@validator({ | |
rules: { | |
name: 'required', |
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
#!/usr/bin/env bash | |
# run command: | |
# wget -qO- https://gist.githubusercontent.com/stenin-nikita/069e653666be5612aec509011c2af498/raw/install-packages.sh | DB_ROOT_PASSWORD="secret" DB_USER_PASSWORD="secret" bash | |
export DEBIAN_FRONTEND=noninteractive | |
function print_green { | |
echo -e "\e[32m${1}\e[0m" | |
} |
NewerOlder