#MySQL Cheat Sheet
##Selecting a database: mysql> USE database;
##Listing databases: mysql> SHOW DATABASES;
##Listing tables in a db: mysql> SHOW TABLES;
<?php | |
/** | |
* Register our sidebars and widgetized areas. | |
* | |
*/ | |
function arphabet_widgets_init() { | |
register_sidebar( array( | |
'name' => 'Home right sidebar', | |
'id' => 'home_right_1', |
<!-- Start the Loop. --> | |
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> | |
<!-- Test if the current post is in category 3. --> | |
<!-- If it is, the div box is given the CSS class "post-cat-three". --> | |
<!-- Otherwise, the div box is given the CSS class "post". --> | |
<?php if ( in_category( '3' ) ) : ?> | |
<div class="post-cat-three"> | |
<?php else : ?> |
<?php | |
/* | |
Plugin Name: Template Site Plugin for example.com | |
Description: Site specific plugin template for example.com, in this case we are creating a widget | |
*/ | |
//////////////////////////////////////////// | |
// Start Adding Functions Below this Line // | |
//////////////////////////////////////////// | |
// Create a widget |
<?php | |
/* | |
Plugin Name: Template Site Plugin for example.com | |
Description: Site specific plugin template for example.com, in this case we are creating a widget | |
*/ | |
//////////////////////////////////////////// | |
// Start Adding Functions Below this Line // | |
//////////////////////////////////////////// | |
/* self-closing shortcode */ |
<?php | |
class Person { | |
private $name; | |
public function __construct($name) { | |
$this->name = $name; | |
} | |
public function getName() { | |
return $this->name; |
#MySQL Cheat Sheet
##Selecting a database: mysql> USE database;
##Listing databases: mysql> SHOW DATABASES;
##Listing tables in a db: mysql> SHOW TABLES;
##Theme Structure
Template | Description |
---|---|
header.php | Header Section |
index.php | Main Section |
sidebar.php | Sidebar Section |
single.php | Post Template |
page.php | Page Template |
comments.php | Comment Template |
##PHP Array Functions
array_diff (arr1, arr2 ...)
array_filter (arr, function)
array_flip (arr)
array_intersect (arr1, arr2 ...)
I posted several talks about compiling PHP from source, but everyone was trying to convince me that a package manager like Homebrew was a more convenient way to install.
The purpose of Homebrew is simple: a package manager for macOS that will allow you to set up and install common packages easily and allows you to update frequently using simple commands.
I used a clean installation of macOS Sierra to ensure all steps could be recorded and tested. In most cases you already have done work on your Mac, so chances are you can skip a few steps in this tutorial.
I’ve made this according to the installation instructions given on GetGrav.