Based on this article.
npm install --save-dev dependency-cruiser
choco install graphviz
function withTimer(func: (...args: any[]) => any, userDefinedName?: string): (...args: any[]) => any { | |
const functionName = userDefinedName || func.name || 'unknown'; | |
console.log('Decorator applied to:', functionName); | |
return function (...args) { | |
const start = performance.now(); // Get high-resolution time before execution | |
const result = func.apply(this, args); | |
//func(...args); // Execute the original function | |
const end = performance.now(); // Get high-resolution time after execution | |
const duration = end - start; // Calculate the duration |
const doAsyncOperationWithRetry = async <T>( | |
operation: () => Promise<T>, | |
{ | |
retry = true, | |
maxRetries = 3, | |
}: { | |
retry?: boolean; | |
maxRetries?: number; | |
} = {} | |
): Promise<T> => { |
export const testFunction = () => { | |
return Array(1000).fill(2).map((n, i) => n * i).map((n, i) => n * i ** 2) | |
} |
SELECT id, column FROM table | |
where id::VARCHAR = ANY (ARRAY['b329a9b1-54fb-4d5e-853e-4c58555ab0de', 'fc666e0a-0dd1-4d02-990c-4ae52324da36']) |
import { compact, every, includes, isEmpty, map, some } from 'lodash'; | |
interface OpenAPIOperation { | |
path: string; | |
action: 'get' | 'post' | 'put' | 'delete'; | |
parameters: string[]; | |
} | |
function checkOpenApiForOps( | |
openApiJson: any, |
// Playground URL: https://www.typescriptlang.org/play?#code/KYOwrgtgBAKsDOAXKBvAUFTUCGUC8UARAIKEA0GWARvkQELmWYDGtAjBQL5prMD2IeHwA2wAHTC+AcwAUhAKLhoAa2ABPeOSgB5KgCtgzRGNUaZcJAEoxAMwCWwxMABOMmQDdL+AHxQ78ADlsAJkAyCoXD0toyx4bMBAjOwEoUEgANWxhMAQAGX9EAB4YVIAPJxAAE3hUTm8ZNIgYPgBhAXcXRAAuWEsemABtUz4bWABdAbHUJih+QWRTGoJdAyMTdXgGpWa2kA7nRGt7R0ionz9A4NDwyM9ogG4Z52BEMGcQKEWxCGwABxllOdGjt2p0hjgasNRjAxpZHtxeAIkFAnEhMtkEP0EIhJrRGuicvB8khzNi4Tw5kJRBJpHJFJAoO4soStKjEASEOSgA | |
enum Test { | |
a = "A", | |
b = "B", | |
c = 1, | |
} | |
console.log("Enum keys", Object.keys(Test).filter((v) => isNaN(Number(v)))) |
Based on this article.
npm install --save-dev dependency-cruiser
choco install graphviz
from __future__ import annotations | |
from typing import Any, Dict, List, NamedTuple, Union | |
import xml.etree.ElementTree as ET | |
class XmlNode(NamedTuple): | |
'''A helper class to make navigating xml files in python nicer and to create virtual XML nodes that can be saved''' | |
tag: str | |
attrib: Dict[str, Any] |
import ee | |
image_col = ee.ImageCollection(...) # This should work with FeatureCollections and other GEE iterables | |
img_list = image_col.toList(image_col.size()) | |
for img_idx in range(0, image_col.size().getInfo()): | |
img = ee.Image(img_list.get(img_idx)) | |
... |