Skip to content

Instantly share code, notes, and snippets.

View WebBamboo's full-sized avatar
🤫

Pavel Petrov WebBamboo

🤫
  • Web Bamboo Ltd.
View GitHub Profile
@WebBamboo
WebBamboo / PagespeedChecker.php
Last active June 19, 2020 09:06
Pagespeed Insights Checker in PHP
<?php
/**
* @author: Pavel Petrov
* Pagespeed Insights API wrapper for PHP
* Article: https://codingstories.net/what-is-google-pagespeed-and-why-does-it-matter
*/
class PagespeedChecker {
private $apiKey = false;
private $url = '';
private $pagespeed;
@WebBamboo
WebBamboo / plugin.php
Created June 2, 2020 11:43
Wordpress Plugin Boilerplate
<?php
/**
* Plugin Name: Boilerplate
* Plugin URI: http://webbamboo.net
* Description: Boilerplate for WP plugin
* Version: 0.1
* Author: Webbamboo Ltd
* Author URI: http://webbamboo.net
* License: GPL2.
**/
@WebBamboo
WebBamboo / EntityBase.php
Last active April 12, 2019 12:20
symfony doctrine updatedAt createdAt updated_at created_at fields timestamp
<?php
namespace App\Mapping;
use Doctrine\ORM\Mapping as ORM;
use DateTime;
/**
* Class EntityBase
*
<?php
function isSerialized($data)
{
set_error_handler(function($errno, $errstr){
if($errno == E_WARNING) {
throw new \Exception($errstr);
} else if($errno == E_NOTICE) {
throw new \Exception($errstr);
}
@WebBamboo
WebBamboo / loop.js
Created November 18, 2016 17:24
Loop through JS object
for (var key in p) {
if (p.hasOwnProperty(key)) {
console.log(key + " -> " + p[key]);
}
}