Skip to content

Instantly share code, notes, and snippets.

View perjerz's full-sized avatar
🏠
Working from home

Siwat Kaolueng perjerz

🏠
Working from home
View GitHub Profile
@armanozak
armanozak / rxjs-7_retry-resetOnSuccess.ts
Created May 3, 2021 09:17
[What's New in RxJS 7] RxJS 7 retry resetOnSuccess #blog #rxjs
import { defer, from } from "rxjs";
import { retry, tap } from "rxjs/operators";
const values = ["_", 0, 1, 0, 2, 0, 3, 0, 0, 0, 4];
defer(() => {
values.shift();
return from(values);
})
.pipe(
@steveruizok
steveruizok / cacheflowelike.ts
Created June 27, 2021 21:05
A beautiful shape for tldraw.
// Run this code on tldraw.com
// By @steveruizok
// Based on an awesome image by @cacheflowe: https://twitter.com/cacheflowe/status/1408902719130288130
new NumberControl({
label: 'radius',
value: 200,
min: 50,
max: 500,
})
@acoshift
acoshift / index.html
Last active January 30, 2022 10:11
<!doctype html>
<html lang=en>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ethers.umd.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/@metamask/[email protected]/dist/detect-provider.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js" defer></script>
<script>
window.abi = {
'IERC20': [
{
@peerreynders
peerreynders / README.md
Last active September 14, 2022 14:19
µsignal 0.4.2 performance comparison

Sample run on Ubuntu 22.04 LTS [i7-4900MQ CPU @ 2.80GHz/32GB] Chromium 105.0.5195.102

Solid (solid.html)

Created 205760 nodes.
278 ms; sum: 9.11303444731602e+305

@preact/signals (preactive.html)

@pjlamb12
pjlamb12 / data-table.component.html
Created November 26, 2022 23:49
Angular Data Table Component
<content-section
[csTitle]="title"
[collapsible]="collapsible"
[state]="state"
[locked]="locked"
[noButtons]="noButtons"
[buttons]="_buttons"
>
<!-- Custom controls -->
<ng-content></ng-content>
addEventListener("fetch", e => {
if (e.request.destination !== "image" || // Only do this when requesting an image
request.mode === "no-cors") // We don't know the status of no-cors images
return;
e.respondWith((async () => {
try {
const response = await fetch(e.request);
if (response.ok)
return response;
const TMDB_IMAGE_BASE_URL = 'https://image.tmdb.org/t/p/';
addEventListener("fetch", e => {
const url = new URL(e.request.url);
if (url.pathname === "/image") {
e.respondWith((async () => {
const width = url.searchParams.get("width");
const path = url.searchParams.get("path");
try {
return await fetch(`${TMDB_IMAGE_BASE_URL}/w${width}${path}`, {mode: "no-cors"});