Skip to content

Instantly share code, notes, and snippets.

View Xethron's full-sized avatar

Bernhard Breytenbach Xethron

View GitHub Profile
@Xethron
Xethron / keybase.md
Last active February 21, 2021 13:32
keybase.md

Keybase proof

I hereby claim:

  • I am xethron on github.
  • I am bbreyten (https://keybase.io/bbreyten) on keybase.
  • I have a public key ASA4IcjsjjQxA_1Nm5_f8ORnjw94ItRJ7hQgE0kd-xbtOgo

To claim this, I am signing this object:

@Xethron
Xethron / LaravelScopes.php
Last active August 29, 2015 14:16
What Laravel Scopes are made for...
<?php
// We had a relationship similar to the one below:
public function currentParameters()
{
return $this->hasOne('Parameter')->where('active_date', '<=', Carbon::now())->orderBy('active_date', 'DESC');
}
// This pretty much got the last active parameter for a specific model.
// However, sometimes we wanted to see into the future/past, which wasn't entirely possible.
// Especially if you wanted to eagerload it.
@Xethron
Xethron / gist:1b5749d59d4bd2ed72cf
Last active August 29, 2015 14:16
Random list of tools I use

Random list of tools I use

There are many tools one can use to improve productivity, however, its sometimes the simplest of changes/configuration to your existing tools that makes the most impact.

As an example: Bash Scripts. If you're writing more than 15 characters in bash multiple times a day with random IP's and tags to remember, write a simple shorthand function. Examples:

  • Instead of typing scp -P 5555 /some/path/to/file.php username@some.random.ip.address:/var/www/project/current/some/path/to/file.php, I have a little script: scp{projectname} /some/path/to/file.php. It already knows our server details, and the path relative to the project (both locally for autocompletion, and on the server). It also sends out a HipChat notification that the certain file has been overwritten, so I don't have to worry about keeping the team in the loop. (Yes, I do push files directly to our live production server from time to time, sue me)

Also, being 100% comfortable with your IDE is extremely important. Set i

@Xethron
Xethron / MultiUserProvider.php
Last active November 15, 2017 16:51
Laravel 4 Authenticate Multiple User Provider Allows Laravel Auth to login using multiple tables and/or databases/Eloquent User Models... Each User Model can have its own Hasher and Hasher options...
<?php //app/libraries/MultiUserProvider.php
use Illuminate\Auth\UserProviderInterface,
Illuminate\Auth\UserInterface,
Illuminate\Auth\GenericUser;
class MultiUserProvider implements UserProviderInterface {
protected $providers;
@Xethron
Xethron / mds_collivery.js
Created July 5, 2013 09:51
Attempt to move over from jQuery to Prototype
var $j = jQuery.noConflict();
document.observe('dom:loaded', function() {
var isZA_B;
var isZA_S;
var setShipping = false;
function setFields (shipto) {
$$("label[for='" + shipto + ":region_id']")[0].addClassName('required');
@Xethron
Xethron / custom_override_checkout_fields.php
Created June 11, 2013 07:52
Only display MDS Shipping fields if MDS was selected as the shipping method on Cart Page
<?php
function custom_override_checkout_fields( $fields ) {
// Get global WooCommerce Object
global $woocommerce;
// Get the shipping label
$shipping_label = $woocommerce->cart->shipping_label;

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users