Skip to content

Instantly share code, notes, and snippets.

View johnzenith's full-sized avatar
🎯
...Building apps with JavaScript, TypeScript, Rust, Go, PHP

John Musa johnzenith

🎯
...Building apps with JavaScript, TypeScript, Rust, Go, PHP
View GitHub Profile
@johnzenith
johnzenith / nigerian-states.json
Created January 1, 2025 23:46 — forked from chrisidakwo/nigerian-states.json
All 36 states in Nigeria, and their local government areas - including the Federal Capital Territory and its area councils
{
"Abia": [
"Aba North",
"Aba South",
"Arochukwu",
"Bende",
"Ikwuano",
"Isiala-Ngwa North",
"Isiala-Ngwa South",
"Isuikwato",

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@johnzenith
johnzenith / functions.php
Created June 5, 2021 10:39 — forked from tripflex/functions.php
Programmatically create a WooCommerce Subscription and associated WooCommerce Order
<?php
public function give_user_subscription( $product, $user_id, $note = '' ){
// First make sure all required functions and classes exist
if( ! function_exists( 'wc_create_order' ) || ! function_exists( 'wcs_create_subscription' ) || ! class_exists( 'WC_Subscriptions_Product' ) ){
return false;
}
$order = wc_create_order( array( 'customer_id' => $user_id ) );
@echo off
set /p domain="Enter Domain: "
set OPENSSL_CONF=../conf/openssl.cnf
if not exist .\%domain% mkdir .\%domain%
..\bin\openssl req -config cert.conf -new -sha256 -newkey rsa:2048 -nodes -keyout %domain%\server.key -x509 -days 3650 -out %domain%\server.crt
echo.
echo -----
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
@johnzenith
johnzenith / Common-Currency.json
Created April 1, 2021 04:26 — forked from ksafranski/Common-Currency.json
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@johnzenith
johnzenith / countries.json
Created March 22, 2021 13:23 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@johnzenith
johnzenith / traffic.html
Created December 1, 2020 23:39 — forked from bellbind/traffic.html
[javascript]simulator of traffic jams
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>sim traffic jam</title>
<script src="traffic.js"></script>
</head>
<body>
<div>
<canvas id="canvas" width="300" height="300"></canvas>
@johnzenith
johnzenith / http-status-codes-javascript
Created November 29, 2020 01:53 — forked from pngmark/http-status-codes-javascript
HTTP status codes for JavaScript array
var statusMessages = [
'200': 'OK',
'201': 'Created',
'200': 'OK',
'201': 'Created',
'202': 'Accepted',
'203': 'Non-Authoritative Information',
'204': 'No Content',
'205': 'Reset Content',
'206': 'Partial Content',
@johnzenith
johnzenith / localState.js
Created September 7, 2020 13:09 — forked from tombuyse/localState.js
Local state
export class UserList extends Component {
state = {
isLoading: false,
hasError: false,
users: []
}
searchUsers(value) {
this.setState({isLoading: true});