Skip to content

Instantly share code, notes, and snippets.

// see https://www.npmjs.com/package/node-apple-receipt-verify#configoptions-object
// https://medium.com/axel-springer-tech/debugging-and-reading-apple-receipts-2e47f9793f74
import { parseArgs } from "jsr:@std/cli/parse-args";
import { config as appleReceiptVerifyConfig, validate } from "npm:node-apple-receipt-verify";
const params = {
string: ["environment"],
boolean: ["ignoreExpired", "extended", "verbose", "ignoreExpiredError", "excludeOldTransactions"],
alias: {
p: "environment",
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\IE.AssocFile.HTM\shell\open\command]
@="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" -private %1"
[HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command]
@="\"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\" --incognito -- \"%1\""
[HKEY_CLASSES_ROOT\ChromeBHTML\shell\open\command]
@="\"C:\\Program Files\\Google\\Chrome Beta\\Application\\chrome.exe\" --incognito -- \"%1\""
@jeiea
jeiea / m-function-matcher.js
Created June 10, 2024 11:06
for named export
var xr=Object.create;var kn=Object.defineProperty;var Ur=Object.getOwnPropertyDescriptor;var wr=Object.getOwnPropertyNames;var Pr=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty;var Mn=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Sr=(n,e,r,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let f of wr(e))!Er.call(n,f)&&f!==r&&kn(n,f,{get:()=>e[f],enumerable:!(u=Ur(e,f))||u.enumerable});return n};var Te=(n,e,r)=>(r=n!=null?xr(Pr(n)):{},Sr(e||!n||!n.__esModule?kn(r,"default",{value:n,enumerable:!0}):r,n));var Ie=Mn(a=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.Type=a.JsonType=a.JavaScriptTypeBuilder=a.JsonTypeBuilder=a.TypeBuilder=a.TypeBuilderError=a.TransformEncodeBuilder=a.TransformDecodeBuilder=a.TemplateLiteralDslParser=a.TemplateLiteralGenerator=a.TemplateLiteralGeneratorError=a.TemplateLiteralFinite=a.TemplateLiteralFiniteError=a.TemplateLiteralParser=a.TemplateLiteralParserError=a.TemplateLiteralResolver=a.TemplateLiteralPattern=a.TemplateLiteralPattern
/**
* Create a configuration getter that reads from command line arguments, environment variables,
* and a .env file in the priority.
* @param args Result of deno std's [parseArgs](https://deno.land/std/cli/parse_args.ts)
* @param getEnv Function to get environment variables
* @param dotEnv Record from a .env file
* @returns A function that returns the value for a configuration parameter
*/
export function configSource<T>(
{ args, getEnv, dotEnv }: {
/**
* Multiplexes multiple async iterators into a single async iterable iterator.
* @param args An array of async iterators to be multiplexed.
* @returns An async iterable iterator that yields values immediately from iterators.
*/
export async function* multiplex<T, N>(
args: readonly AsyncIterator<T, void, N>[],
): AsyncIterableIterator<T> {
const promises = new Map<AsyncIterator<T, unknown, N>, ReturnType<typeof step<T, N>>>();
args.forEach((iterator) => promises.set(iterator, step(iterator)));
export function atomFamilyStrict<
Key,
Args extends unknown[],
AtomType extends {
onMount?: (set: (...args: Args) => void) => void | (() => void);
},
>(initializeAtom: (param: Key) => AtomType) {
const atoms = new Map<string, AtomType>();
const family = (key: Key) => {
@jeiea
jeiea / build.gradle.kts
Created August 31, 2023 04:24
React native kotlin DSL build script example
import com.facebook.react.utils.KotlinStdlibCompatUtils.toBooleanStrictOrNullCompat
import java.util.Properties
plugins {
id("com.android.application")
id("com.facebook.react")
}
apply(from = "../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle")
val applyNativeModulesAppBuildGradle: groovy.lang.Closure<Any> by extra
@jeiea
jeiea / aws_mfa_shell.ts
Last active September 1, 2023 05:24
Why should I write this
import { parse } from "https://deno.land/x/[email protected]/mod.ts";
import { parseFlags } from "https://deno.land/x/[email protected]/flags/mod.ts";
type Config = { profile?: string; serial?: string };
let fileConfig: undefined | Config;
if (import.meta.main) {
await main();
}
extension ObjectExt<T> on T {
R let<R>(R Function(T) x) => x(this);
}
class ProgramCardDataFamily {
const ProgramCardDataFamily();
ProgramCardDataProvider call( int data) {
return ProgramCardDataProvider( data);
}
import { expandGlob } from "https://deno.land/[email protected]/fs/expand_glob.ts";
main().catch(console.error);
async function main() {
const osEscaper = Deno.build.os === "windows" ? "`" : "\\";
const readPromises: Promise<string>[] = [];
for await (const path of Deno.args) {
const escaped = path.replace(/(\[|\])/g, (_, arg) => `${osEscaper}${arg}`);
for await (const entry of expandGlob(escaped, { extended: false })) {