Skip to content

Instantly share code, notes, and snippets.

View alphaolomi's full-sized avatar
🎯
Focusing

Alpha alphaolomi

🎯
Focusing
View GitHub Profile
@alphaolomi
alphaolomi / numberWithCommas.ts
Created March 19, 2022 14:10
Number with commas (JS/TS)
// Number with commas
function numberWithCommas(x: number): string {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function toLocaleStringSupportsLocales(number: number | string) {
if (typeof number === "string") {
return parseFloat(number).toLocaleString();
}
return number.toLocaleString();
@alphaolomi
alphaolomi / form.tsx
Last active March 19, 2022 14:12
RHF Smart Form
import React from "react";
import { useForm, UseFormReturn, SubmitHandler } from "react-hook-form";
type InputProps = React.DetailedHTMLProps<
React.InputHTMLAttributes<HTMLInputElement>,
HTMLInputElement
>;
const Input = React.forwardRef<HTMLInputElement, InputProps>((props, ref) => (
<label htmlFor={props.name}>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
@alphaolomi
alphaolomi / toc.md
Created September 17, 2021 04:55
LARAVEL TESTING like a Champ

TABLE OF CONTENTS

Getting started

  • Intro
  • Our first HTTP test
  • Using a database
  • Using factories
  • Factory relations
@alphaolomi
alphaolomi / torrent_trackers.txt
Created July 29, 2021 19:59
July29_2021_torrent_tacker
http://tracker2.wasabii.com.tw:6969/announce
http://www.wareztorrent.com:80/announce
udp://bt.xxx-tracker.com:2710/announce
udp://tracker.eddie4.nl:6969/announce
udp://tracker.grepler.com:6969/announce
udp://tracker.mg64.net:2710/announce
udp://wambo.club:1337/announce
udp://tracker.dutchtracking.com:6969/announce
udp://tc.animereactor.ru:8082/announce
udp://tracker.justseed.it:1337/announce
@alphaolomi
alphaolomi / Number Assignments in TZ.md
Created July 15, 2021 09:05
Number Assignments in TZ

Number Assignments

S/N OPERATOR 7-digit Assignments STATUS
1. MIC Tanzania PLC 071 + Y XXXXXX
065 + Y XXXXXX
067 + Y XXXXXX
Operational
2. Tanzania Telecommunications Corporation 073 + Y XXXXXX Operational
3. Vodacom Tanzania PLC 074 + Y XXXXXX
075 + Y XXXXXX
076 + Y XXXXXX
Operational
4. Zanzibar Telecom PLC 077 + Y XXXXXX Operational
5. Airtel Tanzania PLC 078 + Y XXXXXX
068 + Y XXXXXX
069 + Y XXXXXX
Operational
6. Smile Communications Tanzania Limited 066 + Y XXXXXX
@alphaolomi
alphaolomi / readme.md
Created July 4, 2021 07:14
Simple Readme

Title

a very long description

1. About

2. Purpose

3. What problems does it solve?

4. How does it work?

@alphaolomi
alphaolomi / index.md
Last active November 30, 2024 10:14
Quote of the Day (QOTD) Protocol

Quote of the Day

from https://www.gkbrk.com/wiki/qotd_protocol/

Tags: networking protocol

Quote of the Day is a simple protocol that is used to deliver daily quotes. Although its usage is almost nonexistent these days, there are still a few public servers. The protocol is defined by RFC 865. According to the RFC, a QOTD server is run on port 17 for TCP and UDP connections.

The RFC recommends that;

@alphaolomi
alphaolomi / users.test.ts
Created February 3, 2021 05:27
Axios Mocking with Typescript
// users.test.ts
import axios from 'axios';
import Users from '../src/users';
jest.mock('axios');
const mockedAxios = axios as jest.Mocked<typeof axios>;
let us: Users;
beforeAll(() => {
us = new Users();
@alphaolomi
alphaolomi / object_merge.js
Created August 6, 2020 09:07
Spread Operator in JS
const morning = {
breakfast: "oatmeal",
lunch: "peanut butter and jelly"
}
const dinner = "mac and cheese"
const backpackingMeals = {
...morning,
dinner
}