Skip to content

Instantly share code, notes, and snippets.

Zane Matthew zanematthew

Block or report user

Report or block zanematthew

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View foo.js
// A
return state[item_type].indexOf(item_id) != -1 ? true : false;
// B
return Boolean(state[item_type].find(items => items === item_id));
@zanematthew
zanematthew / wp-cli.bash
Last active Aug 29, 2016
Useful WP CLI commands
View wp-cli.bash
####
# 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 / [Laravel] Geocoder
Last active Oct 9, 2016
An example of reverse geo coding, using Geocoder Laravel, as seen in a Laravel 5.3 route
View [Laravel] Geocoder
<?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 / site-name.conf
Last active Aug 29, 2016
Nginx – Redirect WP uploads directory to another server.
View site-name.conf
####
#
# Note this file should be place in:
# cd /etc/nginx/custom-sites/
# Then be sure to restart nginx:
# $ sudo service nginx restart
location ~ ^/wp-content/uploads/(.*) {
if (!-f $request_filename) {
rewrite ^/wp-content/uploads/(.*)$ https://SOME-OTHER-URL-HERE.com/$1 redirect;
}
View gist:86857f46b1753a92f7b3e4ed9c498af9
<?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 Jul 29, 2016
My WordPress packages, note PHPCS, PHPMD and best done from the command line, due to tons of coding styles conflicting.
View Package Control.sublime-settings
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"AlignTab",
"DocBlockr",
"Material Theme",
View .nanorc
## 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.
View keybase.md

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:

@zanematthew
zanematthew / functions.php
Created Sep 21, 2015
ZM ALR 2.0.0 -- Adding a new field
View functions.php
<?php
/**
* Adding a new field to the register form
*
* These are the steps needed to add a new field in ZM ALR (2.0.0+)
* They are as follows:
* 1. Add your field to the array of fields
* 2. Check the validation of your new field
* 3. Do something with the value AFTER successful registration
@zanematthew
zanematthew / nginx.conf
Created Jul 3, 2015
Block direct EDD downloads for WordPress Networking
View nginx.conf
# Block direct EDD downloads for WordPress Networking
location ~ ^/wp-content/uploads/sites/(.*)/edd/(.*?)\.zip$ {
rewrite / permanent;
}
You can’t perform that action at this time.