Skip to content

Instantly share code, notes, and snippets.

View AustinMatherne's full-sized avatar

Austin Matherne AustinMatherne

  • Remote
View GitHub Profile
@AustinMatherne
AustinMatherne / detect_filer_cash_flow_linkrole.py
Created March 16, 2024 19:21
Detect Filer Cash Flows LinkRole
baseTaxonomyCashFlowLinkRole = 'https://www.esma.europa.eu/xbrl/role/all/...'
baseTaxonomyCashFlowRels = baseTaxonomyModelXbrl.relationshipSet(XbrlConst.parentChild, baseTaxonomyCashFlowLinkRole)
baseTaxonomyCashFlowClarks = {
rel.toModelObject.qname.clarkNotation
for rel in baseTaxonomyCashFlowRels.modelRelationships
}
for root in baseTaxonomyCashFlowRels.rootConcepts:
baseTaxonomyCashFlowClarks.add(root.qname.clarkNotation)
@AustinMatherne
AustinMatherne / observable-lifecycles.ts
Last active November 1, 2019 11:11
Angular `ObservableLifecycles` Component Base Class
import {
OnChanges,
OnInit,
DoCheck,
OnDestroy,
AfterContentInit,
AfterContentChecked,
AfterViewInit,
AfterViewChecked,
SimpleChanges
@AustinMatherne
AustinMatherne / ngif-data-binding-removal.ts
Created October 2, 2017 21:23
ngIf Data Binding Removal
import {Observable} from 'rxjs/Observable';
import {of} from 'rxjs/observable/of';
@Component({
selector: 'my-app',
template: `
<ng-container *ngIf="data$ | async as data"> <!-- removed from dom -->
<div>
Data: {{data}} <!-- removed from dom -->
</div>
@AustinMatherne
AustinMatherne / ngLet-data-binding.ts
Created October 2, 2017 21:09
ngLet Data Binding
import {Observable} from 'rxjs/Observable';
import {of} from 'rxjs/observable/of';
import {LetDirective} from './let.directive';
@Component({
selector: 'my-app',
template: `
<ng-container *ngLet="data$ | async as data"> <!-- single subscription -->
<div>
@AustinMatherne
AustinMatherne / ngif-data-binding.ts
Created October 2, 2017 18:30
ngIf Data Binding
import {Observable} from 'rxjs/Observable';
import {defer} from 'rxjs/observable/defer';
import {of} from 'rxjs/observable/of';
@Component({
selector: 'my-app',
template: `
<ng-container *ngIf="data$ | async as data"> <!-- single subscription -->
<div>
Data: {{data}} <!-- 0.4431839407652687 -->
@AustinMatherne
AustinMatherne / multiple-async-pipe.ts
Created October 2, 2017 18:26
Multiple Async Pipes
import {Observable} from 'rxjs/Observable';
import {defer} from 'rxjs/observable/defer';
import {of} from 'rxjs/observable/of';
@Component({
selector: 'my-app',
template: `
<div>
Data: {{data$ | async}} <!-- 0.2762838374749106 -->
</div>
@AustinMatherne
AustinMatherne / let.directive.ts
Created October 2, 2017 17:49
Angular Let Directive
import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core';
interface LetContext<T> {
ngLet: T;
}
@Directive({
selector: '[ngLet]'
})
export class LetDirective<T> {
@AustinMatherne
AustinMatherne / string-enum-typed-reducer.ts
Created September 29, 2017 05:02
String Enum Typed Reducer
// counter.reducer.ts
import { CounterActions, CounterTypes } from './counter.actions';
export function reducer(state: number = 0, action: CounterActions): State {
switch(action.type) {
case CounterTypes.INCREMENT: {
return state + 1;
}
case CounterTypes.DECREMENT: {
return state - 1;
@AustinMatherne
AustinMatherne / const-typed-reducer.ts
Created September 29, 2017 05:01
Const Typed Reducer
// counter.reducer.ts
import * as CounterActions from './counter.actions';
export type Action = CounterActions.All;
export function reducer(state: number = 0, action: Action): State {
switch(action.type) {
case CounterActions.INCREMENT: {
return state + 1;
}
@AustinMatherne
AustinMatherne / const-typed-actions.ts
Created September 29, 2017 05:00
Const Typed Actions
// counter.actions.ts
import { Action } from '@ngrx/store';
export const INCREMENT = '[Counter] Increment';
export const DECREMENT = '[Counter] Decrement';
export const RESET = '[Counter] Reset';
export class Increment implements Action {
readonly type = INCREMENT;
}