Skip to content

Instantly share code, notes, and snippets.

View zoracon's full-sized avatar

Alexis zoracon

View GitHub Profile
@zoracon
zoracon / set-array-to-vars.php
Last active August 29, 2015 14:06
PHP: Objective: Putting an array into variables
<?php
list($var_1,$var_2,$var_3,$var_4,$var_5) = explode(",", $var_array['5-Vars']));
?>
@zoracon
zoracon / filter-explained.php
Last active August 29, 2015 14:06
WordPress Filters Simple Explanation
<?php
function function_that_params_get_accepted(param_1, param_2) {
//code goes here;
}
//Define the Action
add_filter('function_hook_name', 'function_that_params_get_accepted', 10 , 2); // 10 == priority & 2 = # of params needed (defined from above)
@zoracon
zoracon / refactor.php
Last active August 29, 2015 14:07
Code Refactor Example
<?php
// Refactoring
//Repetitive code in several places, had to package it into a function
// 1. This was everywhere (about 5 files)
$post_category_ids = array();
$post_terms = get_the_terms(get_the_ID(), 'category');
if ($post_terms && !is_wp_error($post_terms)) {
foreach ($post_terms as $post_term) {
@zoracon
zoracon / WP_CLI.php
Last active August 29, 2015 14:22
Demonstrated use of WP_CLI
/**
* Creates Footer Menus for Footer Options in Theme Manager
* @subcommand create-footer-menus
*/
function create_footer_menus() {
$site_name = get_bloginfo('name');
$menu_name = 'footer-menu';
WP_CLI::line('Parsing Footer Menus for: ' . $site_name);
@zoracon
zoracon / keybase.md
Last active December 24, 2018 23:45

Keybase proof

I hereby claim:

  • I am zoracon on github.
  • I am zoracon (https://keybase.io/zoracon) on keybase.
  • I have a public key ASA9pI0yrtU4PTfcvE2RiKHnZqp1yvCXiSIJbcL_zPawLwo

To claim this, I am signing this object:

@zoracon
zoracon / audit_ext_chrome.md
Last active November 9, 2019 17:40
Audit Accessibility of Extension Popup (Chrome)

@zoracon
zoracon / EASE_MODE.md
Last active February 26, 2020 16:22
EASE

@zoracon
zoracon / weather
Last active July 22, 2020 16:58
Updated Weather Bash Script: From "Wicked Cool Shell Scripts"
#!/bin/bash
# weather--Gets the weather for a specific region or ZIP code.
if [ $# -ne 1 ]; then
echo "Usage: $0 <zipcode>"
exit 1
fi
apikey="[whatever your key is]"
@zoracon
zoracon / openssl_certdates
Last active September 24, 2020 16:43
Get Dates for SSL Cert via OpenSSL
#!/bin/bash
# Get Expiry dates for SSL Cert
if [ $# -ne 1 ]; then
echo "Usage: $0 <servername>"
exit 1
fi
sn=$1
@zoracon
zoracon / docker-python.txt
Last active July 22, 2020 16:57
Docker Run Python Command Line
docker run -it -v "$(pwd)"/whatever-path-has-script/:/name-for-docker-path python:latest python3 /name-for-docker-path/script.py