Skip to content

Instantly share code, notes, and snippets.

@paullessing
paullessing / tradfri-button-blueprint.yaml
Last active October 18, 2023 16:48
TRADFRI Remote blueprint - Home Assistant
blueprint:
name: Cover control with Tradfri open/close remote Z2M
description: |
Control a cover with an Ikea Tradfri open/close button remote over Zigbee2MQTT
Short press on ☼ button will open the cover.
Short press on ☰ button will close the cover.
Long press on ☼ or ☰ will stop the cover.
domain: automation
input:
@paullessing
paullessing / input.scss
Created May 18, 2023 08:05
Generated by SassMeister.com.
@mixin font-size($size, $important: false) {
font-size: $size isImportant($important);
}
@function isImportant($important) {
@if $important {
@return '!important';
} @else {
@return '';
}
@paullessing
paullessing / release.when-pushed.yml
Last active July 5, 2021 11:58
GitHub Actions: Publishing bundled packages with TypeScript
name: Releases
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
@paullessing
paullessing / release.yml
Last active May 6, 2020 10:09
GitHub Actions: Publishing bundled packages with TypeScript: Configuring the build environment
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: yarn install --frozen-lockfile
- run: yarn pack --filename=release.tgz
@paullessing
paullessing / release.yml
Last active May 6, 2020 10:04
GitHub Actions: Publishing bundled packages with TypeScript: Setting up triggers
name: Releases
on:
push:
branches: [ master ]
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question(`Do a thing? (Y/n) `, answer => {
if (!answer || answer.trim().toLowerCase() === 'y') {
// do something
@paullessing
paullessing / todo-effects.ts
Created February 25, 2018 17:44
Handling Errors in NgRx Effects - Snippet 4 (TodoEffects)
@Injectable()
export class TodoEffects {
@Effect()
public fetchListOfTodos$: Observable<void> = this.action$.pipe(
ofType(ActionTypes.FETCH_TODO_LIST),
switchMap(() =>
this.todoListService.fetchTodoList().pipe(
map((todos: Todo[]) => {
return {
type: ActionTypes.TODO_LIST_FETCHED,
@paullessing
paullessing / todo-effects.ts
Last active February 25, 2018 17:46
Handling Errors in NgRx Effects - Snippet 3 (TodoEffects, bad error handling)
@Injectable()
export class TodoEffects {
@Effect()
public fetchListOfTodos$: Observable<void> = this.action$.pipe(
ofType(ActionTypes.FETCH_TODO_LIST),
switchMap(() => this.todoListService.fetchTodoList()),
map((todos: Todo[]) => {
return {
type: ActionTypes.TODO_LIST_FETCHED,
payload: { todos }
@paullessing
paullessing / todo-effects.ts
Last active February 25, 2018 17:46
Handling Errors in NgRx Effects - Snippet 2 (TodoEffects without Error Handling)
@Injectable()
export class TodoEffects {
@Effect()
public fetchListOfTodos$: Observable<void> = this.action$.pipe(
ofType(ActionTypes.FETCH_TODO_LIST),
switchMap(() => this.todoListService.fetchTodoList()),
map((todos: Todo[]) => {
return {
type: ActionTypes.TODO_LIST_FETCHED,
payload: { todos }
@paullessing
paullessing / analytics-effects.ts
Last active February 25, 2018 17:46
Handling Errors in NgRx Effects - Snippet 1 (AnalyticsEffects, no Error Handling)
@Injectable()
export class AnalyticsEffects {
@Effect({ dispatch: false })
public routeChange$: Observable<void> = this.action$.pipe(
ofType(ROUTER_NAVIGATION),
map(({ payload }) => {
this.analyticsService.trackPageNavigation(payload);
})
);
}