Skip to content

Instantly share code, notes, and snippets.

View peterson-umoke's full-sized avatar
🏠
Working from home, Freelancer, Software Engineer

Peterson Umoke peterson-umoke

🏠
Working from home, Freelancer, Software Engineer
View GitHub Profile
@peterson-umoke
peterson-umoke / .htaccess
Created June 23, 2022 23:30
Clean .php from any php file
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
@peterson-umoke
peterson-umoke / deploy.php
Created June 19, 2021 18:47 — forked from oxguy3/deploy.php
Script used to automatically deploy from GitHub to a cPanel shared hosting server
<?php
/**
* deploy.php by Hayden Schiff (oxguy3)
* Available at https://gist.github.com/oxguy3/70ea582d951d4b0f78edec282a2bebf9
*
* No rights reserved. Dedicated to public domain via CC0 1.0 Universal.
* See https://creativecommons.org/publicdomain/zero/1.0/ for terms.
*/
// random string of characters; must match the "Secret" defined in your GitHub webhook
@peterson-umoke
peterson-umoke / e-shop.py
Last active June 3, 2021 02:18
Just a simple python program to create and use a shopping cart
# set the items the store sells
shopItems = [
{
"item": "Beans",
"price": 1000,
},
{
"item": "Rice",
"price": 200,
},
@peterson-umoke
peterson-umoke / sql2excel.php
Created August 17, 2020 17:07
export sql results to excel
<?php
/*******EDIT LINES 3-8*******/
$DB_Server = "localhost"; //MySQL Server
$DB_Username = "root"; //MySQL Username
$DB_Password = ""; //MySQL Password
$DB_DBName = "backoffice"; //MySQL Database Name
$filename = "excelfilename"; //File Name
/*******YOU DO NOT NEED TO EDIT ANYTHING BELOW THIS LINE*******/
//create MySQL connection
$sql = 'Select * from $DB_TBLName';
@peterson-umoke
peterson-umoke / countdown.js
Created July 26, 2020 19:10
Use to get timezone diff with solutions
<!-- Display the countdown timer in an element -->
<p id="demo"></p>
<script>
// Set the date we're counting down to
var localTime = new Date("Jan 5, 2021 15:37:25").getTime();
// convert the time to the current timezone
var localOffset = new Date("Jan 5, 2021 15:37:25").d.getTimezoneOffset() * 60000;
const statesInNigeria = [
{
state: "ABIA",
lga: ["AROCHUKWU", "INI ", "OBI NGWA", "UGWUNAGBO", "UKWA EAST "],
},
{
state: "ADAMAWA",
lga: [
"DEMSA",
"FUFORE",
@peterson-umoke
peterson-umoke / IntelIJTrialReset.bat
Created February 17, 2020 10:40
How to Reset InteIIiJ IDEA Evaluation Key in Windows
cd "C:%HOMEPATH%\.IntelliJIdea*\config"
rmdir "eval" /s /q
del "options\other.xml"
reg delete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\jetbrains\idea" /f
:: This will work for idea 2018.3 and later
::
:: It is Highly Advised to Purchase the JetBrain Softwares
:: This is only for the case You just want to Extend the
:: Trial Period and Evaluate the IDE for some more Time
@peterson-umoke
peterson-umoke / view.blade.php
Created January 22, 2020 20:27
how to use modal inside laravel view template
@php
$users2 = DB::select('select * from users where active = ?', [1]); // user raw sql and prepared statements
$users1 = DB::table('users')->get(); // using query builder
@endphp
dd($users1)
dd($users2)
@peterson-umoke
peterson-umoke / hiddenInput.js
Created June 13, 2019 10:47
This code snippet is used to check for the value change of a hidden input field
var hiddenFieldID = $("#ins_appraisal_ins_appraisal_settingsins_appraisal_settings_idb");
var oldValueField = hiddenFieldID.val();
setInterval(function() {
if (oldValueField !== hiddenFieldID.val()) {
oldValueField = hiddenFieldID.val();
hiddenFieldID.val(oldValueField).trigger('change');
}
}, 1000);
$(hiddenFieldID).change(function() {
console.log('lkljsdf', $(this).val());
@peterson-umoke
peterson-umoke / help.jsx
Last active March 5, 2019 07:54
Need help getting the data into a serialized format
<GridRow reset>
<GridColumn col='half'>
<div className='form-group'>
<select
name='document_type[]'
id='document_type'
required
>
<option value=''>Document Type</option>
<option value'britain'> Britain </option>