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
{ | |
"Component": { | |
"prefix": "fc", | |
"body": [ | |
"import React from 'react';", | |
"", | |
"export interface ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}Props {", | |
"\t$1", | |
"}", | |
"", |
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 { Directive, EventEmitter, HostListener, Input, OnInit, OnDestroy, Optional, Output, Self } from '@angular/core'; | |
import { NgControl } from '@angular/forms'; | |
import { Subject } from 'rxjs'; | |
import { debounceTime, filter, map, pairwise, startWith, takeUntil } from 'rxjs/operators'; | |
/** | |
* Detects when an input is coming from a scanner (or being pasted). | |
*/ | |
@Directive({ | |
selector: '[appScan]', |
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 { AfterViewInit, Directive, ElementRef, Input, ViewChild } from '@angular/core'; | |
import { FocusableOption, FocusOrigin } from '@angular/cdk/a11y'; | |
/** | |
* A base class that can be extended by any component to allow its parent to focus it. All the component needs to do | |
* is set a template reference variable of `focusable` on whichever input it should focus when the parent wants to | |
* focus it. You could even set `focusable` on another custom component, so long as it also extends this class. | |
* | |
* @example | |
* ```html |
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 { Params } from '@angular/router'; | |
import { RouterReducerState } from '@ngrx/router-store'; | |
// Some example context - could be different in your app. | |
export interface CustomRouteSnapshot { | |
url: string; | |
params: Params; | |
queryParams: Params; | |
} | |
export type State = RouterReducerState<CustomRouteSnapshot>; |
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 { OnInit, Input, ElementRef, AfterViewInit } from '@angular/core'; | |
export abstract class FocusComponent implements OnInit, AfterViewInit { | |
/** | |
* The element that can be focused. | |
*/ | |
protected elemToFocus: ElementRef; | |
/** | |
* Can be set on initialization or updated later on to focus an element. |
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
// Service for https://github.com/jackmoore/wheelzoom | |
import { Injectable, NgZone } from '@angular/core'; | |
export interface WheelzoomSettings { | |
zoom: number; | |
maxZoom?: number; | |
initialZoom: number; | |
initialX: number; | |
initialY: number; |
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
let supportsCSSFocusWithin = false | |
try { | |
document.querySelector(':focus-within') | |
} catch (err) { | |
supportsCSSFocusWithin = false | |
} | |
const wrapper = document.querySelector('wrapper') |
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
function ips | |
set eth (ipconfig getifaddr en0) | |
echo "Ethernet: $eth" | |
set wifi (ipconfig getifaddr en1) | |
echo "Wireless: $wifi" | |
end |
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 from 'react' | |
import useEffectAsync from './useEffectAsync' | |
export default function Brownies() { | |
const [brownies, setBrownies] = useState('Loading') | |
useEffectAsync( | |
async didUnmount => { | |
const res = await fetch(`https://api.brownies.com`) | |
if (!didUnmount) setBrownies(res) |
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 { ObservableInput, of, from } from 'rxjs'; | |
import { tap } from 'rxjs/operators'; | |
import { MemoizedFunction, MapCacheConstructor } from 'lodash'; | |
/** | |
* A copy of _.memoize, modified for async | |
* | |
* @see _.memoize | |
* | |
* @param func The function to have its output memoized. |
NewerOlder