Skip to content

Instantly share code, notes, and snippets.

View gmazzap's full-sized avatar

Giuseppe Mazzapica gmazzap

View GitHub Profile
@gmazzap
gmazzap / GMCustomEditorHeight.php
Last active December 21, 2015 11:49
WordPress plugin that gives to users of WP 3.6 chance to change wysiwyg editor height by setting options in the user profile page. Two options: one for desktops, one for mobile.
<?php
/**
* Plugin Name: GM Custom Editor Height
*
* Description: Gives to users of WP 3.6 chance to change wysiwyg editor height by setting options in the user profile page. Two options: one for desktops, one for mobile
* Version: 0.1.0
* Author: Giuseppe Mazzapica
* Requires at least: 3.6
* Tested up to: 3.6
*
@gmazzap
gmazzap / gm-random-background.php
Last active January 1, 2016 20:45
Simple WordPress plugin that extends WP custom background feature to show a random image that change hourly. Images are selected via a checkbox on attachment edit screen. Wordpre for a WPSE anser, see http://wordpress.stackexchange.com/questions/141778/35541
<?php
/**
* Plugin Name: GM Random Background
* Description: Extends WP custom background feature to show a random image that change hourly
* Plugin URI: http://wordpress.stackexchange.com/questions/141778/35541
* Author: G. M.
* Author URI: http://wordpress.stackexchange.com/users/35541/g-m
*
*/
@gmazzap
gmazzap / CptInMainQueryByMeta.php
Created January 10, 2014 14:42
Simlpe plugin coded to refactor the code posted on a WPSE anwser
<?php
/**
* Plugin Name: Cpt In Main Query By Meta
* Plugin URI: http://wordpress.stackexchange.com/questions/129236/
* Description: Allow mixing a post type with another on main query, only if the second match some meta query args
* Author: Giuseppe Mazzapica
* Author URI: http://wordpress.stackexchange.com/users/35541/g-m
*/
@gmazzap
gmazzap / PrivatePostAccess.php
Created January 24, 2014 13:05
A WordPress plugin that generate and handle urls that allow access to posts in non-public status.
<?php
/**
* Plugin Name: Private Post Access
* Plugin URI: http://wordpress.stackexchange.com/questions/130967/get-full-page-html-for-a-non-public-wordpress-page
* Description: Generate and handle urls that allow access to posts in non-public status.
* Author: G. M.
* Author URI: http://wordpress.stackexchange.com/users/35541/g-m
*
*/
@gmazzap
gmazzap / Angie.php
Last active April 6, 2016 17:35
Very simple, quite powerful, extensible, plain-PHP one-class template engine.
<?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
{
@gmazzap
gmazzap / AutoPaginatedQuery.php
Last active April 8, 2016 21:49
`WP_Query` subclass that takes a non-paginated query and split into different paginated queries offering a transparent interface to "standard loop" usage.
<?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 August 24, 2016 20:53
Format url for Google sitemaps
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 / PointersManager.php
Last active January 13, 2017 19:06
Pointers Tour (WPSE 162794)
<?php namespace GM;
class PointersManager implements PointersManagerInterface {
private $pfile;
private $version;
private $prefix;
private $pointers = array();
public function __construct( $file, $version, $prefix ) {

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:

<?php
// require the class
@require_once __DIR__ . '/mycaptcha.php';
// defaults
$w = 110;
$h = 35;
$random_dots = 0;
$random_lines = 20;
$captcha_text_color = "0x#B9B098";