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 | |
//This function let convert BBcode to HTML | |
function bbcode_to_html($text) | |
{ | |
$text = nl2br(htmlentities($text, ENT_QUOTES, 'UTF-8')); | |
$in = array( | |
'#\[b\](.*)\[/b\]#Usi', | |
'#\[i\](.*)\[/i\]#Usi', | |
'#\[u\](.*)\[/u\]#Usi', | |
'#\[s\](.*)\[/s\]#Usi', |
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 | |
/** | |
* You can modify preg_match_all to match your needs | |
* | |
* Extracts attribute values inside an element from html content | |
* You post html content and inside the content, you have shortcodes with attributes like [pageBreak id="home" title="Home page"] | |
* You want to extract id and title attribute values so you can save them in db as a matching pair. | |
*/ | |
$content = 'hello there [pageBreak ="home" title="Home page"] new page [/pageBreak] another page'; | |
extract($content); |
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
{ | |
"require": { | |
"stripe/stripe-php": "^6.8", | |
"phpmailer/phpmailer": "^6.0", | |
"symfony/polyfill-mbstring": "^1.8" | |
} | |
} |
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
<style> | |
.penguin { | |
/* change code below */ | |
--penguin-skin: gray; | |
--penguin-belly: white; | |
--penguin-beak: orange; | |
/* change code above */ | |
position: relative; |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>404 - Page Not Found!</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<link rel="dns-prefetch" href="//fonts.gstatic.com"> | |
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> |
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..." |
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
/** | |
* 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 | |
/** | |
* 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
{ | |
"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." |