Skip to content

Instantly share code, notes, and snippets.

View ReubenFrimpong's full-sized avatar
💭
Always Learning 😊

Reuben Frimpong ReubenFrimpong

💭
Always Learning 😊
View GitHub Profile
@koolamusic
koolamusic / useAsyncHandler.js
Last active October 8, 2022 14:21
A Function to Handle executing other functions in an Asynchronous manner, using Async await, and tryCatch while handling errors declaratively
async function useAsyncHandler(callback) {
try {
const data = await callback
return [data, null]
} catch(error) {
console.error(error, "error log from async handler")
return [null, error]
}
@lavoiesl
lavoiesl / CodeGenerator.php
Created August 1, 2012 04:24
Generate a random string of non-ambiguous numbers and letters.
<?php
class CodeGenerator
{
private static $alphabet = '23456789abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
private static $max_offset = 55;
/**
* Generate a random character of non-ambiguous number or letter.
* @return string the character