Skip to content

Instantly share code, notes, and snippets.

View chan-dev's full-sized avatar
💭
I may be slow to respond.

Christian M. Austria chan-dev

💭
I may be slow to respond.
View GitHub Profile
@vespertilian
vespertilian / conditional_effects.ts
Created February 9, 2017 04:09
Two options for conditional ngrx effects
@Effect()
selectAndLoadStore$: Observable<Action> = this.actions$
.ofType(storeActions.SELECT_AND_LOAD_STORE)
.withLatestFrom(this.store.select(ngrx.storeState))
.map(([action, storeState]) => [action.payload, storeState])
.switchMap(([storeName, storeState]) => {
const existsInStore = Boolean(storeState.urlNameMap[storeName]);
return Observable.if(
() => existsInStore,
Observable.of(new storeActions.SetSelectedStore(storeName)),
@Kovrinic
Kovrinic / .gitconfig
Last active May 16, 2024 07:53
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "git@github.com:"]
insteadOf = git://github
@milankorsos
milankorsos / redux-actions.ts
Last active November 10, 2022 10:58
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
@jeffochoa
jeffochoa / Response.php
Last active May 22, 2024 04:06
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
// This code is assumed to be part of one of the extension's content scripts
function addIframe() {
const iframe = document.createElement('iframe');
iframe.addEventListener('load', () => {
iframe.contentWindow.postMessage({
eventName: 'init',
iframeSrc: 'https://xkcd.com/' // whatever url you want. Probably will be a URL to your own domain in practice
}, '*');
}, false);
@panva
panva / README.md
Last active October 5, 2023 02:47
Simple Device Flow Login CLI implementation

Simple Device Flow Login CLI implementation

run

npx https://gist.github.com/panva/ebaacfe433a8677bdbf458f6e1132045
@bradtraversy
bradtraversy / docker-help.md
Last active June 1, 2024 15:14
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@onderceylan
onderceylan / events.reducer.ts
Last active April 26, 2021 18:17
Entity adapter and some of the CUD operations - reducer
import * as fromEvents from '../actions/events.action';
import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity';
import { Event } from '../../models/event.model';
export interface EventsState extends EntityState<EventEntity> {
loaded: boolean;
loading: boolean;
error: Error;
}
@LayZeeDK
LayZeeDK / angular-cli-node-js-typescript-rxjs-compatiblity-matrix.csv
Last active May 31, 2024 13:49
Angular CLI, Angular, Node.js, TypeScript, and RxJS version compatibility matrix. Officially part of the Angular documentation as of 2023-04-19 https://angular.io/guide/versions
Angular CLI version Angular version Node.js version TypeScript version RxJS version
~16.0.0 ~16.0.0 ^16.13.0 || ^18.10.0 >=4.9.5 <5.1.0 ^6.5.5 || ^7.4.0
~15.2.0 ~15.2.0 ^14.20.0 || ^16.13.0 || ^18.10.0 >=4.8.4 <5.0.0 ^6.5.5 || ^7.4.0
~15.1.0 ~15.1.0 ^14.20.0 || ^16.13.0 || ^18.10.0 >=4.8.4 <5.0.0 ^6.5.5 || ^7.4.0
~15.0.5 ~15.0.4 ^14.20.0 || ^16.13.0 || ^18.10.0 ~4.8.4 ^6.5.5 || ^7.4.0
~14.3.0 ~14.3.0 ^14.15.0 || ^16.10.0 >=4.6.4 <4.9.0 ^6.5.5 || ^7.4.0
~14.2.0 ~14.2.0 ^14.15.0 || ^16.10.0 >=4.6.4 <4.9.0 ^6.5.5 || ^7.4.0
~14.1.3 ~14.1.3 ^14.15.0 || ^16.10.0 >=4.6.4 <4.8.0 ^6.5.5 || ^7.4.0
~14.0.7 ~14.0.7 ^14.15.0 || ^16.10.0 >=4.6.4 <4.8.0 ^6.5.5 || ^7.4.0
~13.3.0 ~13.3.0 ^12.20.2 || ^14.15.0 || ^16.10.0 >=4.4.4 <4.7.0 ^6.5.5 || ^7.4.0