Skip to content

Instantly share code, notes, and snippets.

View mattparker's full-sized avatar

Matt Parker mattparker

View GitHub Profile
@mattparker
mattparker / installing gcov and ltp for php.md
Last active December 3, 2023 05:08
trying to compile php with gcov
vagrant@php7dev:~/php-src$ ./configure --enable-gcov --prefix=/usr/local/php70-gcov

gives, eventually:

configure: error: To enable code coverage reporting you must have LTP installed
@mattparker
mattparker / install-and-compile-php7
Last active November 28, 2021 17:36
running php tests with lcov/gcov - setup and getting close
# install lcov
apt-get update
apt-get install lcov
mkdir /usr/local/php70-gcov5
cd ~/php-src
./configure --enable-gcov --prefix=/usr/local/php70-gcov5 --with-apxs2=/usr/bin/apxs2 --with-gd --without-pear --with-jpeg-dir=/usr --with-png-dir=/usr --with-vpx-dir=/usr --with-freetype-dir=/usr --with-t1lib=/usr --enable-gd-native-ttf --enable-exif --with-config-file-path=/etc/php7 --with-config-file-scan-dir=/etc/php7/conf.d --with-mysql=/usr --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-zlib --with-gmp --with-zlib-dir=/usr --with-gettext --with-kerberos --with-imap-ssl --with-mcrypt=/usr/local --with-iconv --enable-sockets --with-openssl --with-pspell --with-pdo-mysql=mysqlnd --with-pdo-sqlite --enable-soap --enable-xmlreader --with-xsl --enable-ftp --enable-cgi --with-curl=/usr --with-tidy --with-xmlrpc --enable-mbstring --enable-sysvsem --enable-sysvshm --enable-shmop --with-readline --enable-fpm --enable-intl --enable-zip --with-imap --with-mysqli=mysqlnd --enable-calendar
make
make install
@mattparker
mattparker / onename
Created January 8, 2016 12:20
onename
Verifying that +mattparker is my blockchain ID. https://onename.com/mattparker
@mattparker
mattparker / uses for traits.md
Last active December 28, 2015 14:29
Traits

Replace globals

E.g.

trait ConfigProvider {
    
    private $_configProviderConfig;
    
    public function setConfigProvider($cfg) {
 }
@mattparker
mattparker / gist:5636276
Created May 23, 2013 14:00
amends yui scroll beacon to add a 'left' synthetic event
/* Gallery beacon with extra module */
YUI.add('gallery-scroll-beacon', function(Y) {
/**
* Provides synthetic event to detect beacon element arriving in or leaving the browser viewport.
*
* @module scroll-beacon
*/
/**
@mattparker
mattparker / yui2uploaderpatch.js
Last active December 16, 2015 21:49
Patches for YUI2 Uploader for IE9+
////////////////////////////////////////////////////
////////////////////////////////////////////////////
// Patch
//
// Was using a non-standard quirk of IE to do
// document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />')
// when it should really be just document.createElement('iframe') and then add attributes
// IE9 is strict about this and breaks.
//
//
@mattparker
mattparker / gist:5420634
Last active December 16, 2015 10:29 — forked from lsmith/gist:5417052
var buildParser = Y.cached(function (prefix, suffix, separator, decimal) {
var regexBits = []
regex;
if (prefix) {
regexBits.push('^' + prefix.replace(safeRegExp, '\\$1'));
}
if (suffix) {
regexBits.push(suffix.replace(safeRegExp, '\\$1') + '$');
}
@mattparker
mattparker / wheresTheMemory.js
Created April 3, 2013 22:39
A little hacky effort at testing YUI javascript memory usage using Node.js and phantomjs
var util = require('util')
http=require('http'),
phantom=require('node-phantom'),
// simple logging of memory use:
memoryCache = [0],
logMemory = function (msg) {
var mem = process.memoryUsage();
//console.log(msg + " current memory use: ", util.inspect(process.memoryUsage()));
console.log(msg + " heapUsed change: " + (mem.heapUsed - memoryCache[memoryCache.length - 1]));
@mattparker
mattparker / gist:4505998
Created January 10, 2013 21:34
docblock efforts for strtotime
/**
* @class Date
* @static
*/
/**
* @for Date
* @method strtotime
*
* Parses English (or other languages) date-related sentences into
@mattparker
mattparker / _getOffsetAndFinish.js
Created November 6, 2012 17:27
idea for kb refactor of Y.Color.Harmony
/**
Generates a series of colors from startColor at various offsets
@protected
@method _getOffsetAndFinish
@param {String} startColor Start color
@param {Array} arrOffsets Array of colors
@param {String} [to]
@returns {Array} Of offsetted and finished colors
**/
_getOffsetAndFinish: function (startColor, arrOffsets, to) {