Skip to content

Instantly share code, notes, and snippets.

View zanematthew's full-sized avatar

Zane Matthew zanematthew

View GitHub Profile
@zanematthew
zanematthew / [Laravel] Geocoder
Last active October 9, 2016 12:19
An example of reverse geo coding, using Geocoder Laravel, as seen in a Laravel 5.3 route
<?php
$router->group(['middleware' => ['web']], function ($router) {
$router->get('/geo-code', function () {
echo '<p>This is a test for getting the site visitors <strong>full</strong> addressed.
Based on a hardcoded <code>lat</code> and <code>long</code>, which are later derived via JavaScript.</p>
<p>The expected result should be <strong>2261 Sidney Avenue Baltimore, Maryland 21230</strong>.</p>
<p>The lat / long used <code>39.262884899999996, -76.63305849999999</code></p>
<hr />';
try {
@zanematthew
zanematthew / wp-cli.bash
Last active August 29, 2016 20:49
Useful WP CLI commands
####
# Useful WP CLI commands
#
# All are presumed to be ran from the location of the `wp-config` file in
# question.
#
# Add an admin user
$ wp user create some-user-name my-email@my-site.com --role=administrator
@zanematthew
zanematthew / .bashrc
Last active August 20, 2016 19:30
The most awesome bash prompt e^er!1 // Place this code in your ~/.bash_prompt file
git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; }
HOST='\033[02;36m\]\h'; HOST=' '$HOST
TIME='\033[01;31m\]\t \033[01;32m\]'
LOCATION=' \033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
BRANCH=' \033[00;33m\]$(git_branch)\[\033[00m\]\n\$ '
PS1=$TIME$USER$HOST$LOCATION$BRANCH
PS2='\[\033[01;36m\]>'
<?php
// This is a sample for getting a request
Route::get('/request', function (\Illuminate\Http\Request $request) {
var_dump($request->input('code'));
dd($request);
if ($request->has('code')) {
$referral = $request->input('code');
@zanematthew
zanematthew / Package Control.sublime-settings
Created July 29, 2016 15:48
My WordPress packages, note PHPCS, PHPMD and best done from the command line, due to tons of coding styles conflicting.
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"AlignTab",
"DocBlockr",
"Material Theme",
## Sample initialization file for GNU nano
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read! Also note that characters specially
## interpreted by the shell should not be escaped here.
##
## To make sure a value is not enabled, use "unset <option>"
##
## For the options that take parameters, the default value is given.
## Other options are unset by default.

Keybase proof

I hereby claim:

  • I am zanematthew on github.
  • I am zanematthew (https://keybase.io/zanematthew) on keybase.
  • I have a public key whose fingerprint is E819 EADC 34B1 8C07 B0BB B1C7 A95C 1EDB 1719 5D6C

To claim this, I am signing this object:

#!/usr/bin/env bash
#apt-get install -y git-all
## Themes
REPOS[0]='git@github.com:zanematthew/sample.git'
REPOS[1]='git@github.com:zanematthew/sample-2.git'
for repo in ${REPOS[*]}
do
@zanematthew
zanematthew / gist:5945722
Created July 8, 2013 01:56
non-working IE8 AJAX success. ajaxSubmit plugin: http://jquery.malsup.com/form/#getting-started
$('#jdugc_upload_form').on('submit', function(event) {
event.preventDefault();
$('.loading-icon').show();
$(this).ajaxSubmit({
target: 'myResultsDiv',
type: 'post',
dataType: 'json',
start: function(){
$('.loading-icon').show();
@zanematthew
zanematthew / gist:3518338
Created August 29, 2012 20:20
Ways to prevent "deep nesting"
<?php
foreach( $items as $item ){
if ( ! $item['name'] )
continue;
print $item['name'];
// more code
// and stuff going on here