Skip to content

Instantly share code, notes, and snippets.

View mkormendy's full-sized avatar
🛠️
Building, fixing, making a living

Mike Kormendy mkormendy

🛠️
Building, fixing, making a living
View GitHub Profile
@mkormendy
mkormendy / php_apache_homebrew.md
Created January 4, 2018 06:42 — forked from DragonBe/php_apache_homebrew.md
Installation of Apache 2.4 and PHP 7.1 with Homebrew

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.

Apache and PHP with homebrew

I’ve made this according to the installation instructions given on GetGrav.

@spivurno
spivurno / gw-gravity-forms-format-date-merge-tags.php
Last active May 31, 2019 15:52
Gravity Wiz // Gravity Forms // Add Formatting Options for Date Merge Tags
<?php
/**
* Gravity Wiz // Gravity Forms // Add Formatting Options for Date Merge Tags
* http://gravitywiz.com/
*
* {Date:1:dmy} => 31/1/2017
* {Date:2:l} => Tuesday
*
* See PHP's date() function documentation for full details on formatting:
* http://php.net/manual/en/function.date.php
@mkormendy
mkormendy / php-cheatsheet.md
Created January 21, 2016 05:26
PHP Super Cheatsheet

##PHP Array Functions

array_diff (arr1, arr2 ...)

array_filter (arr, function)

array_flip (arr)

array_intersect (arr1, arr2 ...)

@mkormendy
mkormendy / wordpress-cheatsheet.md
Last active February 22, 2021 14:23
WordPress Cheatsheet

##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
@mkormendy
mkormendy / mysql_cheatsheet.md
Last active April 7, 2016 21:22
MySQL Cheatsheet

#MySQL Cheat Sheet

##Selecting a database: mysql> USE database;

##Listing databases: mysql> SHOW DATABASES;

##Listing tables in a db: mysql> SHOW TABLES;

@mkormendy
mkormendy / self-this.php
Created January 21, 2016 04:07
When to use self over $this
<?php
class Person {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
@mkormendy
mkormendy / plugin-template(shortcodes).php
Last active January 21, 2016 05:30
Site-Specific WordPress Plugin Template (shortcodes)
<?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 */
@mkormendy
mkormendy / plugin-template(widget).php
Last active January 21, 2016 05:30
Site-Specific WordPress Plugin Template (widgets)
<?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
@mkormendy
mkormendy / loop.php
Created January 20, 2016 16:05
Loop Example
<!-- 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 : ?>
@mkormendy
mkormendy / functions.php-widgets
Created January 20, 2016 16:03
Sidebar Widgets
<?php
/**
* Register our sidebars and widgetized areas.
*
*/
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Home right sidebar',
'id' => 'home_right_1',