Skip to content

Instantly share code, notes, and snippets.

View omitobi's full-sized avatar
👑
The faithful shall receive the crown of life from Jesus

Oluwatobi Samuel Omisakin omitobi

👑
The faithful shall receive the crown of life from Jesus
View GitHub Profile
@omitobi
omitobi / gist:c51da78f7b591a22fcfba849077754de
Created January 3, 2024 13:10
Jetbrains Use cheatsheet
1. Search words matching
a. set[\s\S]*?Attribute - Searches for setHelloAttribute, setHiAttribute, etc any words starting with 'set' and 'Attributes'
@omitobi
omitobi / connect.js
Created November 12, 2021 14:49
connect to mongo once
await mongoose.connect(dbUrl, {
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
useFindAndModify: false,
});
const connection = mongoose.connection;
connection.once("open", function() {
@omitobi
omitobi / pre-commit-eslint
Created March 9, 2022 19:21 — forked from linhmtran168/pre-commit-eslint
Pre-commit hook to check for Javascript using ESLint
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@omitobi
omitobi / custom_logs_handler.php
Created July 14, 2023 06:49
Custom Laravel Logs Handler
<?php
declare(strict_types=1);
namespace App\ExampleDirectory\Loggers;
use Monolog\Handler\HandlerInterface;
use Monolog\Logger as MonologLogger;
use Illuminate\Log\Logger;
use Psr\Log\LoggerInterface;
@omitobi
omitobi / ts-boilerplate.md
Created August 6, 2021 09:03 — forked from silver-xu/ts-boilerplate.md
Setup a Node.js project with Typescript, ESLint, Prettier, Husky

Setup a Node.js project with Typescript, ESLint, Prettier, Husky

1_D8Wwwce8wS3auLAiM3BQKA

Starting a personal node project could be easy; starting a team node project could be challenging.

I am a developer currently working in SEEK Australia.

In my experience, common mistakes developer make when starting a projects are:

  • No Linting
@omitobi
omitobi / ideas.md
Last active October 6, 2020 19:27
Ideas to implement
  • Carbonate - Carbon+Collections (PHP)
  • Watson conversation's sdk for php (or Laravel)
    • setting context, (on the fly)
  • Purely Original thoughts of people's post on social media (starting with friends on Facebook)
  • Notes app - add quick personal notes to copy
  • Synchronous communication on JS (example with chat)
@omitobi
omitobi / replicate.php
Last active July 29, 2020 13:22
Replicate a value
<?php
/**
* Replicate a value
*
* @param $value
* @param int $times - ps: modify it to handle values less than 2
* @param bool $handleClosure
* @return array
*/
@omitobi
omitobi / assertArrayStructure.php
Created November 3, 2017 08:09
assertArrayStructure function for testing PHP_Unit in Laravel
<?php
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
function getSolinorUrl()
{
$json = '{
"sph-account": "test",
"sph-cancel-url": "http://example.test/api/cards/cancel",
"sph-failure-url": "http://example.test/api/cards/failure",
"sph-merchant": "test_merchantId",
"sph-request-id": "6saduyd7-648f-43ee-a65c-8sdaskd8wq",
"sph-success-url": "http://example.test/api/cards/success?for=5",
"sph-timestamp": "2019-04-02T12:31:19Z",
@omitobi
omitobi / helpers.php
Created February 13, 2019 11:58 — forked from molayli/helpers.php
Laravel redirect without return statment
<?php
//.....
if(!function_exists('freeRedirect')){
function freeRedirect($to = '/'){
throw new \Illuminate\Http\Exception\HttpResponseException(redirect($to));
}