Skip to content

Instantly share code, notes, and snippets.

@dmorosinotto
dmorosinotto / create-effect.ts
Last active July 31, 2023 13:28 — forked from e-oz/create-effect.ts
Helper function to handle async call and push value to Signal
//Helper function to handle async call (Observable generator with strategy + safe retry if error) to push value to Signal - useful for State Management with Signal
//READ MORE https://medium.com/@eugeniyoz/application-state-management-with-angular-signals-b9c8b3a3afd7
//ORIGINAL DOCS (NgRx component-store effect) https://ngrx.io/guide/component-store/effect#effect-method
import { isObservable, Observable, of, retry, Subject, Subscription } from 'rxjs';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { DestroyRef, inject } from '@angular/core';
/**
* This code is a copied `ComponentStore.effect()` method from NgRx and edited to:
* 1) be a standalone function;
const log = (tag: string) => tap(
next => console.log(`%c[${tag}: Next]`, 'color: #4CAF50;', next),
error => console.log(`%c${tag}: Error]`, 'color: #F44336;', error),
() => console.log(`%c[${tag}: Complete]`, 'color: #2196F3;')
);
@dmorosinotto
dmorosinotto / ngrxintro.md
Created July 21, 2017 12:57 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

/*!
An experiment in getting accurate visible viewport dimensions across devices
(c) 2012 Scott Jehl.
MIT/GPLv2 Licence
*/
function viewportSize(){
var test = document.createElement( "div" );
test.style.cssText = "position: fixed;top: 0;left: 0;bottom: 0;right: 0;";

node-websocketd

A lightweight node port of websocketd, originally written in go.

Usage

node-websocketd --port=8080 ./count.sh
public Func<IDictionary<string, object>, Task<object>> Invoke(Func<IDictionary<string, object>, object> executor)
{
Func<IDictionary<string, object>, Task<object>> invoker = null;
if (executor.Method.ReturnType != typeof (Task<object>))
{
invoker =
p =>
{
var task = new Task<object>(() => executor(p));
function backup() {
var request = require('request');
var util = require('util');
var date = new Date();
var year = date.getUTCFullYear();
var month = date.getUTCMonth() + 1;
var day = date.getUTCDate();
var body = {
function read(query, user, request) {
var dispatch = {
op1 : operation1,
op2 : operation2,
}
if (request.parameters.operation && dispatch.hasOwnProperty(request.parameters.operation)) {
dispatch[request.parameters.operation](query, user, request);
return;
function read(query, user, request) {
var queryComponents = query.getComponents();
/*
{ filters: null,
selections: [],
projection: null,
ordering: {},
skip: null,
take: 50,
table: 'test',