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 * as React from 'react'; | |
import { useReducerSyncSessionStorage } from '../hooks'; | |
export const aStateAction = '@@my-reducer/A_STATE_ACTION'; | |
export type Action<A, P = {}> = { | |
type: A; | |
payload?: P; | |
} | |
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
# use Install-Module -Name Emojis | |
Import-Module -Name Emojis; | |
function Test-Administrator { | |
$user = [Security.Principal.WindowsIdentity]::GetCurrent(); | |
(New-Object Security.Principal.WindowsPrincipal $user).isInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} | |
function prompt { | |
$realLASTEXITCODE = $LASTEXITCODE; |
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
/* | |
* mapRecursive | |
* author: Aurélien Dupays Dexemple | |
*/ | |
export const isUndefined = (obj: any): obj is undefined => typeof obj === 'undefined'; | |
export function mapRecursive<TInput, TOutput>(fn: (e: TInput, index?: number) => TOutput, [first, ...rest]: TInput[], index: number = 0): TOutput[] { | |
return isUndefined(first) ? [] : [fn(first, index), ...mapRecursive(fn, rest, ++index)]; | |
}; |
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
/* | |
* Promise chain | |
* author: Aurélien Dupays Dexemple | |
*/ | |
import { AxiosStatic, AxiosPromise, AxiosResponse } from 'axios'; | |
export const PromiseChain = (axios: AxiosStatic, promises: AxiosPromise[]): Promise<AxiosResponse<any>> => ( | |
axios.all(promises).then((responses: AxiosResponse[]): AxiosResponse<any> => ( |
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
/* | |
* Detect browser - Browsers | |
* author: Aurélien Dupays Dexemple | |
*/ | |
export type BrowserName = 'Chrome' | | |
'Firefox' | | |
'Safari' | | |
'Internet Explorer' | |
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
/* | |
* Async action | |
* author: Aurélien Dupays Dexemple | |
*/ | |
import { AxiosStatic, AxiosResponse } from 'axios'; | |
import { SyncAction } from './sync-action'; | |
export interface AsyncAction<R extends string = '', S extends string = '', F extends string = '', P extends { [ key: string ]: any } = {}> extends SyncAction<'@@async/action', P> { |
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 PropTypes from 'prop-types'; | |
import IndependentDropdown from './independent-dropdown.jsx'; | |
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
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 PropTypes from 'prop-types'; | |
import map from 'lodash/map'; | |
export default class IndependentDropdown extends Component { | |
constructor(props) { | |
super(props); | |
this.onClickOutside = this.onClickOutside.bind(this); |