Skip to content

Instantly share code, notes, and snippets.

Michael Hull mhull

Block or report user

Report or block mhull

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
@mhull
mhull / Draggable.html
Last active Oct 13, 2017
Draggable elements that have been styled to indicate draggability to users
View Draggable.html
<!-- CSS Stylesheet -->
<link rel='stylesheet' type='text/css' href='css/draggable.css' />
<!-- The things we are dragging -->
<div class='thing'><label>Thing 1</label></div>
<div class='thing'><label>Thing 2</label></div>
<div class='thing'><label>Thing 3</label></div>
<!-- jQuery and jQuery-UI -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
@mhull
mhull / Members_manage_roles_items.php
Last active May 25, 2016
Filter roles list in the Members plugin
View Members_manage_roles_items.php
<?php
/**
* Filter the roles table items on the Users > Roles screen
*
* @param array $roles List of role "slugs" being shown in the table
* @param string $role_view View type for current screen (e.g. all, mine, active, etc)
*
* @return array The filtered $roles array
*/
add_filter( 'members_manage_roles_items', 'my_manage_roles_items', 10, 2 );
@mhull
mhull / .WordPress-Using-hooks.php
Last active Jun 5, 2016
Code examples from my Asheville WordCamp 2016 talk entitled "Using Hooks (and creating your own)"
View .WordPress-Using-hooks.php
<?php
/**
* Attempting to register a post type within a plugin, without using a hook,
* results in a fatal error
*/
$args = array(
... etc ...
);
register_post_type( 'my_post_type', $args );
View Helping_Friendly_Post.php
<?php
/**
* The `Helping_Friendly_Post` class is an exercise in thinking about extending the `WP_Post` class
*
* @see https://github.com/mhull/helping-friendly-plugin/blob/master/lib/class-hphp-post.php
*/
/**
* To get a new extended post by ID
*/
@mhull
mhull / .Autoload.php
Last active Mar 31, 2018
Demonstrates how to autoload classes in PHP, so that we don't have to explicitly require each file for each class used within our code
View .Autoload.php
<?php
/**
* Uses the `spl_autoload_register` function to autoload classes so that we don't have to
* explicitly require each file for each class we use in our code
*/
@mhull
mhull / .Acme-Plugin.php
Last active Aug 11, 2016
A WordPress plugin example using PHP namespaces and autoloading
View .Acme-Plugin.php
<?php
#! /acme-plugin/acme-plugin.php
/**
* Plugin Name: ACME Plugin
* Description: A WordPress plugin example using PHP namespaces and autoloading
* Version: 0.0.0
* Author: Michael Hull
* Author URI: https://resoundingechoes.net
*/
@mhull
mhull / _0.key-template.html
Last active Dec 13, 2016
Playing audio files using JS and HTML, experimentations based on JavaScript30 Day 1
View _0.key-template.html
<!-- Key template -->
<script type='text/html' id='key-template'>
<kbd>{{ key.key }}</kbd>
<span class='sound'>{{ key.name }}</span>
<audio src="sounds/{{ key.name }}.wav"></audio>
</script>
@mhull
mhull / _0.es6-string-literals.js
Last active Dec 17, 2016
Highlights on making a CSS & JS clock, based on Wes Bos's 30 Day Vanilla JS challenge
View _0.es6-string-literals.js
/**
* In the `person.sayHello` function, we are using an ES6 template literal
* to dynamically create a string
*/
var person = {
first: 'Michael',
last: 'Hull',
sayHello: function() {
console.log( `Hi, my name is ${this.first} ${this.last}` );
},
@mhull
mhull / 01-coin-tosses.js
Last active Feb 1, 2017
Comparing the .some() and .every() functions in JavaScript to the "At Least One" rule
View 01-coin-tosses.js
var coinTosses = [
{ isHeads: true, user: 'Michael', time: 1485954569 },
{ isHeads: false, user: 'Michael', time: 1485954575 },
/* ... etc ... */
];
View 00.src\app\app.component.ts
import { Component } from '@angular/core';
You can’t perform that action at this time.