Skip to content

Instantly share code, notes, and snippets.

View caleberi's full-sized avatar
🏠
Working from home

Caleb Adewole Erioluwa caleberi

🏠
Working from home
View GitHub Profile
@caleberi
caleberi / distance.go
Created January 11, 2024 08:45 — forked from hotdang-ca/distance.go
Golang code to calculate distance between two lat/lng decimal coordinates.
package main
import (
"math"
"fmt"
)
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//::: :::
//::: This routine calculates the distance between two points (given the :::
@caleberi
caleberi / .git-commit-template.txt
Created January 3, 2023 09:38 — forked from adeekshith/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@caleberi
caleberi / Knex-Migrations-Seeding.md
Created August 15, 2022 09:01 — forked from NigelEarle/Knex-Migrations-Seeding.md
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@caleberi
caleberi / remove_duplicate_movies.py
Last active September 27, 2021 11:37
A simple script to remove movies and other files from the system
from os import (F_OK, W_OK, access, getcwd, makedirs,
mkdir, remove, rmdir,scandir,fsdecode,path,listdir,name as os_name)
from sys import getfilesystemencoding
from collections import deque
from shutil import move
from logging import error, info
from re import I, compile
class PathNotFoundError(FileNotFoundError):
def __init__(self, path) -> None:
@caleberi
caleberi / decorator_examples.py
Created May 9, 2021 20:02
🚀 Working with decorators in python 🐍.
from functools import wraps
import time as tm
import math as mth
def timer(func):
"""Print the running time of input function"""
@wraps(func)
def time_wrapper(*args, **kwargs):
start_time = tm.perf_counter()
/*
* Sample code showing how test suit are structured
*/
function test(description,cb){
try{
cb()
console.log( "✅ "+ description);
}
catch(e){
console.log(e)
@caleberi
caleberi / eslintrc.js
Created March 1, 2021 19:06 — forked from samartioli/eslintrc.js
ESLint config example
var MAX_CHARS = 120;
var SPACES_PER_TAB = 4;
var MAX_NESTED_CALLBACKS = 3;
var MAX_PARAMS = 3;
var MAX_STATEMENTS = 10;
module.exports = {
// http://eslint.org/docs/rules/