Skip to content

Instantly share code, notes, and snippets.

View AliceWonderMiscreations's full-sized avatar

Alice Wonder AliceWonderMiscreations

  • Alice Wonder Miscreations
View GitHub Profile
@AliceWonderMiscreations
AliceWonderMiscreations / tumbleMistress.php
Last active August 29, 2015 14:22
Simple php to implement the tumblr redirect
<?php
/* make this the index page served at *.whatever.tld
* so it will be served with olivia.whatever.tld and fiona.whatever.tld etc.
*
*
* manually maintained list or you could do a database
* array keys (Mistress Names) must be lower case, php array keys
* are case sensitive.
*
* I *think* every active Mistress I follow is here.
<?php
//needs more debug and error handle and stuff
//called by rtaCheckHeader()
function rtaCheckMeta($dom) {
$headList = $dom->getElementsByTagName('head');
if($headList->length > 0) {
$head = $headList->item(0);
$metaList = $head->getElementsByTagName('meta');
@AliceWonderMiscreations
AliceWonderMiscreations / libressl.spec
Created August 3, 2015 17:40
CentOS (RHEL) RPM spec file for LibreSSL
# Builds in mock in CentOS 7
# dev package conflicts with openssl-dev - intentional
# A system should not have both dev packages installed together
# man3 pages in own sub-package
# dev package usually only installed by build system. Keeping
# man pages separate avoids possible name conflict with man
# pages from other dev packages, man pages not needed in build
# system
# openssl binary renamed to libressl
# allows parallel install with vendor openssl without weird
@AliceWonderMiscreations
AliceWonderMiscreations / php-secp256k1.spec
Created December 21, 2015 19:58
spec file for secp256k1-php
%define gitdate 2015.12.21
%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d}
Name: php-secp256k1
Version: 0.0.%{gitdate}
Release: 1%{?dist}
Summary: PHP bindings for bitcoin/secp256k1
Group: Development/Languages
@AliceWonderMiscreations
AliceWonderMiscreations / secp356k1.spec
Created December 21, 2015 19:59
spec file for secp256k1.spec
%define gitdate 20015.12.20
Name: secp256k1
Version: 0.0.%{gitdate}
Release: 1%{?dist}
Summary: Optimized C library for EC operations on curve secp256k1
Group: System Environment/Libraries
License: MIT
URL: https://github.com/bitcoin/secp256k1
private function fixArticleLandmarks() {
$articlelist = $this->xmlBody->getElementsByTagName('article');
$nn = $articlelist->length;
if($nn == 0) {
return;
}
$x = new DOMXPath($this->dom);
for($ii = 0; $ii < $nn; $ii++) {
$arnode = $articlelist->item($ii);
$nodelist = $arnode->getElementsByTagName('aside');
@AliceWonderMiscreations
AliceWonderMiscreations / html5domdoc.class.php
Created January 10, 2018 13:05
php class for generating html5 content as XML with DOMDocument
<?php
/*
+-----------------------------------------------------------------------+
| |
| Copyright (c) 2012-2018 Alice Wonder Miscreations |
| May be used under terms of MIT license |
| |
+-----------------------------------------------------------------------+
| Purpose: HTML5 as XML page generation |
@AliceWonderMiscreations
AliceWonderMiscreations / psr2.phpcs.xml
Created March 15, 2018 12:18
PHP Code Sniffer Rules
<?xml version="1.0" encoding="UTF-8"?>
<!-- PSR-2 but allow closing tags and with some Doc Comment stuff added -->
<ruleset name="AWonderPHP Standard 20180315">
<![CDATA[
These are the rules that I am trying to live by for all my php projects
going forward.
Nutshell - PSR-2 but allowing the closing ?> in pure PHP as I have a very
stubborn fondness for the closing ?> tag and it mentally bothers me when it
is not there. Rational? No, I have no problem with EOF being the closing
Getting both libsodium and apcu working in travis was a pain in the buttucks for me. This is what finally worked:
----------------------------.travis.yml--------------------------------------------------------------------------
language: php
php:
- '7.1'
- '7.2'
env:
- PHPUNIT_VERSION="^7"; PSRSIMPLE_VERSION="^1.0.1"; AWSIMPLE_VERSION="^1.0.0"
before_install:
@AliceWonderMiscreations
AliceWonderMiscreations / awm-rta-label.php
Last active April 25, 2018 20:08
Basic WP plugin to send RTA (Restricted To Adults) voluntary content label
<?php
declare(strict_types=1);
/**
* Plugin Name: AWM RTA Label
* Plugin URI: https://gist.github.com/AliceWonderMiscreations/e65bb21f0d6c9c6842f0a535837077ec
* Description: Globally enables RTA Label on a WordPress Blog. Enable this plugin, and it is done. Disable plugin to undo.
* Version: 2112
* Author: Alice Wonder Miscreations
* Author URI: https://github.com/AliceWonderMiscreations/