Skip to content

Instantly share code, notes, and snippets.

@justinhartman
Created July 9, 2017 01:00
Show Gist options
  • Save justinhartman/6969d9c80b71d0c353bc69554f2dcd59 to your computer and use it in GitHub Desktop.
Save justinhartman/6969d9c80b71d0c353bc69554f2dcd59 to your computer and use it in GitHub Desktop.
This is to be used to demonstrate how you embed Gists into your Github Pages website using Jekyll
{
"name": ".publish",
"path": ".publish",
"sha": "3f949857e8ed4cb106f9744e40b638a7aabf647f",
"size": 9,
"url": "https://api.github.com/repos/justinhartman/howto/contents/.publish?ref=master",
"html_url": "https://github.com/justinhartman/howto/blob/master/.publish",
"git_url": "https://api.github.com/repos/justinhartman/howto/git/blobs/3f949857e8ed4cb106f9744e40b638a7aabf647f",
"download_url": "https://raw.githubusercontent.com/justinhartman/howto/master/.publish",
"type": "file",
"content": "LnB1Ymxpc2gK\n",
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/justinhartman/howto/contents/.publish?ref=master",
"git": "https://api.github.com/repos/justinhartman/howto/git/blobs/3f949857e8ed4cb106f9744e40b638a7aabf647f",
"html": "https://github.com/justinhartman/howto/blob/master/.publish"
}
}
<?php
/*
Ensure that the $age variable is set to null before running the myLife function.
*/
$age = nil
/**
* This function returns a message to the user telling them how old they are.
*
* @param [int] $age Requires an integer value as an input.
* @return [string] Returns a message to the user displaying the input value.
* @author Justin Hartman <justin@hartman.me>
* @copyright Copyright 2017 Justin Hartman. All rights reserved.
* @category Users
*
*/
function myLife($age) {
if (isset($age) && is_int($age)) {
echo "You are ".$age." years old."
} elseif (!isset($age)) {
echo "Please enter your age silly! We'd really like to get to know you better.";
} elseif (!is_int($age)) {
echo "Hmm, you won't believe this but I can't read your age. Tip, only use numbers when entering your age - e.g. 22.";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment