Skip to content

Instantly share code, notes, and snippets.

View Petah's full-sized avatar

David Neilsen Petah

  • Hamilton, New Zealand
View GitHub Profile
<?php
/**
* XMod\Debug\Render\HTML\Hex
*
* @author David Neilsen <david@panmedia.co.nz>
*/
namespace XMod\Debug\Render\HTML;
use XMod\Debug\Render\HTML;
class Hex {
@Petah
Petah / example.php
Last active August 29, 2015 13:57
Raptor behind authorisation
<?php require_once 'path/to/bootstrap.php'; ?>
<html>
<body>
<div class="editable" data-id="body">
<?= get_content('body'); ?>
</div>
<?php if (user_can_edit()): ?>
<script src="raptor.js"></script>
<script>
$('.editable').raptor({
<?php
class MySQLiAsyncQuery {
public $mysqli;
public $query;
public $links;
public $errors;
public $reject;
public $mysqlnd;
public $result;
<?php
use PHPExcel;
use PHPExcel_Cell as Cell;
use PHPExcel_IOFactory as IOFactory;
use PHPExcel_Style_Alignment as Alignment;
use XMod\DataTable;
class XLS {
public $datatable;
@Petah
Petah / linux
Created June 13, 2014 05:12
Composer package differences
installed:
bnet/bnmoney 1.3.3 PHP Library for dealing with money and currency
dflydev/markdown v1.0.3 PHP Markdown & Extra
ezyang/htmlpurifier dev-master 80ebd43 Standards compliant HTML filter written in PHP
facebook/php-sdk v3.2.3 Facebook PHP SDK
fzaninotto/faker dev-master 0b903ea Faker is a PHP library that generates fake data for you.
guzzle/common v3.9.1 Common libraries used by Guzzle
guzzle/http v3.9.1 HTTP libraries used by Guzzle
guzzle/parser v3.9.1 Interchangeable parsers used by Guzzle
guzzle/stream v3.9.1 Guzzle stream wrapper component
Composer version ac497feabaa0d247c441178b7b4aaa4c61b07399 2014-06-10 14:13:12
installed:
bnet/bnmoney 1.3.3 PHP Library for dealing with money and currency
dflydev/markdown v1.0.3 PHP Markdown & Extra
ezyang/htmlpurifier dev-master 80ebd43 Standards compliant HTML filter written in PHP
facebook/php-sdk v3.2.3 Facebook PHP SDK
fzaninotto/faker dev-master 0b903ea Faker is a PHP library that generates fake data for you.
guzzle/common v3.9.1 Common libraries used by Guzzle
guzzle/http v3.9.1 HTTP libraries used by Guzzle
@Petah
Petah / _references.d.ts
Created August 19, 2015 08:09
TypeScript interface, function, variable
/// <reference path="some-name.ts" />
/// <reference path="master.ts" />
@Petah
Petah / _references.d.ts
Created August 19, 2015 08:41
TypeScript namespaces and require
/// <reference path="src/someName.d.ts" />
/// <reference path="src/c1.ts" />
/// <reference path="src/c2.ts" />
/// <reference path="src/app.ts" />
@Petah
Petah / index.php
Last active January 31, 2016 15:57
2-cms
<?php
$view = preg_replace('/[^a-z]/', '', $_SERVER['REQUEST_URI']) ?: 'index';
require __DIR__ . '/layout.php';
<?php
$errors = [
'name' => null,
'email' => null,
'message' => null,
];
if (!empty($_POST)) {
if (!isset($_POST['name'])) {
$errors['name'] = 'Your name is required';
} elseif (strlen($_POST['name']) > 100) {