Skip to content

Instantly share code, notes, and snippets.

View nigelheap's full-sized avatar

Nigel nigelheap

View GitHub Profile
@nigelheap
nigelheap / debug_request.php
Created March 20, 2017 22:36
Wordpress: Prints debug info for the current request
<?php
/**
* Prints debug info for the current request.
* Works well interest just after the opening <head> tag in your header template
*/
function nigelheap_debug_request() {
global $wp, $template;
@nigelheap
nigelheap / get_meta_values.php
Created March 20, 2017 22:33
Wordpress: Returns an array of all meta values over all posts of a certain type based on a key, can be unique or not
<?php
/**
* Returns an array of all meta values over all posts of a certain type based on a key, can be unique or not
*/
function nigelheap_get_meta_values($key = '', $type = 'post', $status = 'publish', $unique = true) {
global $wpdb;
if( empty( $key ) )
<?php
use Illuminate\Support\Collection;
if (! Collection::hasMacro('pluckWithKey')) {
/*
* Keeps the key from the original array while plucking the value from the child array.
* Useful for pulling keyed config form the config files
*
* Example: If you have this:
MYSQL_USER=root
MYSQL_PASS=root
MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
#
# Collect all database names except for
# mysql, information_schema, and performance_schema
#
for f in dbs/*.sql
do
MYSQL_USER=root
MYSQL_PASS=root
MYSQL_CONN="-u${MYSQL_USER} -p${MYSQL_PASS}"
#
# Collect all database names except for
# mysql, information_schema, and performance_schema
#
SQL="SELECT schema_name FROM information_schema.schemata WHERE schema_name NOT IN"
SQL="${SQL} ('mysql','information_schema','performance_schema')"
window.console.log.apply(console, [
'\ %c Made by Itomic %c %c %c http://www.itomic.com.au %c \n\n',
'color: #fff; background: #1dbeea ; padding:5px 0;',
'background: #1dbeea ; padding:5px 0;',
'background: #222222 ; padding:5px 0;',
'color: #fff; background: #222222 ; padding:5px 0;',
'background: #fff; padding:5px 0;'
]);
/**
* Dsu local alias
*/
$aliases['dsu'] = array(
'root' => '/home/username/public_html',
'uri' => 'domain.com',
'path-aliases' => array(
'%dump-dir' => '/tmp',
),
jQuery('.btResOn').click(function(){
__gaTracker('send', {
hitType: 'event',
eventCategory: 'reserva',
eventAction: 'contacto',
eventLabel: 'reserva'
});
});
@nigelheap
nigelheap / git-log2json.sh
Created April 13, 2016 19:15 — forked from textarcana/git-log2json.sh
Convert Git logs to JSON. The first script (git-log2json.sh) is all you need, the other two files contain only optional bonus features :)
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
<?php
$g = stream_context_create(
array("ssl" => array(
"capture_peer_cert" => true
)
)
);
$url = 'itomic.com.au';