Skip to content

Instantly share code, notes, and snippets.

@PeterBooker
PeterBooker / google_font_importer.php
Created October 28, 2013 15:45
Imports Google Webfonts and creates a Dropdown to select a font from.
<?php
/*
* Google Font Importer
*/
$fonts = "https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyCpfnm5kVng8hhP_jnAnnTXVP7MEUM89-k";
$fonts = file_get_contents($fonts, 0, null, null);
$fp = fopen('fonts.txt', 'w');
@PeterBooker
PeterBooker / tooltips.js
Last active July 8, 2021 13:42
Dota 2 Tooltips
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;

Keybase proof

I hereby claim:

  • I am peterbooker on github.
  • I am peterbooker (https://keybase.io/peterbooker) on keybase.
  • I have a public key whose fingerprint is E2D1 65D5 5B52 2988 07AA 1EC8 B872 5CB5 530C 45B7

To claim this, I am signing this object:

@PeterBooker
PeterBooker / get-posts.php
Last active October 23, 2018 18:39
WP REST API Examples
<?php
/**
* Get Public Posts from External Site using REST API
*/
$hostname = 'https://www.peterbooker.com';
$num = 5;
$response = wp_remote_get(
add_query_arg(
array(
@PeterBooker
PeterBooker / Dockerfile
Created October 22, 2018 22:19
PHP-FPM Docker
FROM php:7.2-fpm-alpine
#FROM php:7.3.0RC3-fpm-alpine3.8
# install PHP extensions
RUN apk add --no-cache --virtual .build-deps \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev
RUN docker-php-ext-install \
@PeterBooker
PeterBooker / test-tests-prof.php
Last active October 6, 2018 12:16
First PHP Unit Test
<?php
class Health_Check_Tests_Prof_Test extends WP_UnitTestCase {
private $health_check_site_status;
private $tests_list;
public function setUp() {
parent::setUp();
@PeterBooker
PeterBooker / prof.php
Created October 6, 2018 11:01
Health Check Tests Prof
<?php
echo '<pre>';
$test_list = Health_Check_Site_Status::get_tests();
$tests = array_merge( $tests['direct'], $tests['async'] );
$limit = 5;
echo '<br>';
printf(
'Running tests with %d iterations.',
$limit
@PeterBooker
PeterBooker / icons.php
Created October 2, 2018 18:46
Inline FontAwesome Icons
<?php
/**
* Inlined FontAwesome Icons.
*
* Function returns an SVG icon using the given name.
*/
/**
* Outputs FontAwesome SVG Icons
* https://github.com/FortAwesome/Font-Awesome/tree/master/advanced-options/raw-svg/
@PeterBooker
PeterBooker / migrate.go
Created September 7, 2018 14:14
Example Migration Script
package main
import (
"encoding/json"
"encoding/xml"
"log"
"strconv"
"time"
_ "github.com/go-sql-driver/mysql"
@PeterBooker
PeterBooker / example.go
Created June 17, 2018 21:04
Example of current Zip download and extraction code
package slurper
func GetExtensions(items []string) {
for _, item := range items {
data := downloadZip(item)
extractZip(data)
}
}