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 / 0.autoload_setup.php
Last active Sep 14, 2018
A basic PHP autoloader setup
View 0.autoload_setup.php
<?php
/**
* In this example, we are autoloading classes within the namespace `Acme\ExampleProject`. The file `index.php` is the
* entry point to our project; and we are using the `src` directory to store and organize our PHP class files. Our
* autoloader is located in `autoload.php`
*
* The basic behavior is illustrated in the fact that PHP will autoload the file `src/mammals/human.php` whenever we
* attempt to create a `new \Acme\ExampleProject\Mammals\Human` anywhere in our project's codebase.
*
* This diagram illustrates our project structure. Each file's contents can be found below.
@mhull
mhull / 0.defining_function.html
Last active Aug 11, 2017
Exploring function and set notation
View 0.defining_function.html
<script>
/**
* An example function in JavaScript
*
* @param int myInt
* @param string myString
*
* @return string
*/
@mhull
mhull / 0.no_inputs.php
Last active Jun 21, 2017
Exploring the definition of a function in math and how it can inform my understanding of functions in programming
View 0.no_inputs.php
<?php
/**
* This function has no inputs, so it is not a function from a mathematical
* perspective. Furthermore, the function is not predictable because it depends on
* the state of the underlying program
*/
function say_hello() {
$name = 'World';
@mhull
mhull / 0.function_composition.php
Created May 9, 2017
Examples of function composition using PHP and JavaScript
View 0.function_composition.php
<?php
function f( $x ) {
return $x+5;
}
function g( $x ) {
return $x+1;
}
@mhull
mhull / functions.php
Last active Apr 5, 2018
Demonstrates how to pre-populate checkbox fields when using the Gravity Forms plugin for WordPress
View functions.php
<?php
# Make sure to replace {id} with your form's id
add_filter( 'gform_pre_render_{id}', 'my_populate_checkbox' );
function my_populate_checkbox( $form ) {
/**
* Loop through form fields
*
View 00.src\app\app.component.ts
import { Component } from '@angular/core';
@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 ... */
];
@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 / _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 / .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
*/
You can’t perform that action at this time.