Skip to content

Instantly share code, notes, and snippets.

Giuseppe Mazzapica gmazzap

Block or report user

Report or block gmazzap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gmazzap
gmazzap / VersionNumber.php
Created Mar 24, 2019
Version number parser and comparator compatible with both Semver and WordPress version numbers.
View VersionNumber.php
<?php
/**
* Copyright 2019 Inpsyde GmbH
*
* @license MIT https://opensource.org/licenses/MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@gmazzap
gmazzap / composer.json
Created Apr 7, 2018
Simple example for WCTRN workshop.
View composer.json
{
"name": "gmazzap/wps-wctrn",
"description": "Simple example for WCTRN workshop.",
"type": "project",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"wecodemore/wpstarter": "^2.4"
},
"license": "MIT",
@gmazzap
gmazzap / Brain_HtmlTokenizer.php
Created Feb 18, 2018
A basic, PHP 5.2+ compatible, HTML parser.
View Brain_HtmlTokenizer.php
<?php
/**
* Brain_HtmlTokenizer class file.
*
* (c) Giuseppe Mazzapica
*
* @license http://opensource.org/licenses/MIT MIT
* @author Giuseppe Mazzapica <giuseppe.mazzapica@gmail.com>
*/
View loop.php
<?php
namespace gmazzap;
/**
* @param callable $looper Callback that receives post object, post index and current WP_Query.
* It is possible to use any template tags inside the callback.
* @param array $args Array of WP_Query arguments. Optional, when not provided, main query will be used.
*/
function loop(callable $looper, array $args = null) {
View keybase.md

Keybase proof

I hereby claim:

  • I am gmazzap on github.
  • I am gmazzap (https://keybase.io/gmazzap) on keybase.
  • I have a public key ASAxrrn1I4TqGBN72iGlL41U1bCTwXWnfaK50UT4nQAGYAo

To claim this, I am signing this object:

@gmazzap
gmazzap / AutoPaginatedQuery.php
Last active Apr 8, 2016
`WP_Query` subclass that takes a non-paginated query and split into different paginated queries offering a transparent interface to "standard loop" usage.
View AutoPaginatedQuery.php
<?php
namespace GM;
/**
* `WP_Query` subclass that takes a non-paginated query and split into different
* paginated queries offering a transparent interface to "standard loop" usage.
*
* The class is not 100% transparent:
* - the var `$posts` and the method `get_posts()`, that are not used directly
* in standard loop usage, here don't return array of all posts, but only posts
@gmazzap
gmazzap / LICENSE
Last active Aug 24, 2016
Format url for Google sitemaps
View LICENSE
The MIT License (MIT)
Copyright (c) 2016 Giuseppe Mazzapica
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT
@gmazzap
gmazzap / Angie.php
Last active Apr 6, 2016
Very simple, quite powerful, extensible, plain-PHP one-class template engine.
View Angie.php
<?php namespace GM;
/**
* Angie. Very simple, and quite powerful, plain PHP template engine.
*
* @author Giuseppe Mazzapica <giuseppe.mazzapica@gmail.com>
* @license http://opensource.org/licenses/MIT MIT
*/
class Angie
{
View MetaboxStealer.php
<?php
/**
* @author Giuseppe Mazzapica <giuseppe.mazzapica@gmail.com>
* @license http://opensource.org/licenses/MIT MIT
*/
class MetaboxStealer
{
/**
* @var bool
@gmazzap
gmazzap / Arraize.php
Created Jan 20, 2015
Recursively convert an array or a traversable object into a nested array. Optionally convert all "atomic" items to strings and optionally HTML-encode all strings.
View Arraize.php
<?php namespace GM;
use Traversable;
use JsonSerializable;
/**
* Stateless class that recursively convert an array or a traversable object into a nested array.
* Optionally convert all "atomic" items to strings and optionally HTML-encode all strings.
* Array and traversable objects are all recursively converted.
* Non-traversable objects are converted to array, in 1st available among following methods:
You can’t perform that action at this time.