This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ModuleFilamentServiceProvider.php | |
* | |
* Plugin to load filament resources, pages and widgets for | |
* nwidart/laravel-modules | |
* | |
* @author jgmuchiri | |
* @license MIT | |
* @copyright Copyright (c) 2023, John Muchiri |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gitfixname(){ | |
git filter-branch --env-filter ' | |
WRONG_EMAIL="old or personal email to remove" | |
NEW_NAME="github username" | |
NEW_EMAIL="new email such as private github email" | |
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$NEW_NAME" | |
export GIT_COMMITTER_EMAIL="$NEW_EMAIL" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gitremove(){ | |
echo "Enter file to remove" | |
read FILE | |
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch $FILE' --prune- | |
empty --tag-name-filter cat -- --all | |
git push origin master -f | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cardType($number) | |
{ | |
$number = preg_replace('/[^\d]/', '', $number); | |
if(preg_match('/^3[47][0-9]{13}$/', $number)){ | |
return 'AX'; // 'American Express' | |
} | |
elseif(preg_match('/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/', $number)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pattern ="/^([34|37]{2})([0-9]{13})$/"; | |
//you can now do great things |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"stories": [{ | |
"id":1, | |
"name": "John Muchiri", | |
"title": "Full-stack Developer", | |
"image": "https://randomuser.me/api/portraits/men/34.jpg", | |
"points": 10, | |
"company":"Builders Inc", | |
"story": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi pellentesque fringilla nibh, in congue eros sollicitudin nec. Donec suscipit tellus eu enim ultrices, vel convallis dolor semper. Interdum et malesuada fames ac ante ipsum primis in faucibus. Mauris urna libero, ornare sit amet erat non, dictum molestie arcu." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Report or log an exception. | |
* | |
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | |
* | |
* @param \Exception $exception | |
* @return void | |
*/ | |
public function report(Exception $exception) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Report or log an exception. | |
* | |
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | |
* | |
* @param \Exception $exception | |
* @return void | |
*/ | |
public function report(Exception $exception) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# composer require stripe/stripe-php | |
require_once 'vendor/autoload.php'; | |
$stripe_secret = "" //enter your Stripe key here | |
$plan = "" //enter the subscription plan name | |
\Stripe\Stripe::setApiKey($stripe_secret); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Specify number of backups to keep in days | |
NUMBER_OF_BACKUPS=3 | |
MYSQLDUMP="/usr/bin/mysqldump" | |
MYSQL="/usr/bin/mysql" | |
IGNORE_LIST="SELECT schema_name FROM information_schema.SCHEMATA WHERE schema_name NOT LIKE '% %' AND schema_name NOT LIKE '%-%' AND schema_name != 'information_schema' AND schema_name != 'mysql' AND schema_name != 'performance_schema';" | |
echo "Reading databases..." |
NewerOlder