Skip to content

Instantly share code, notes, and snippets.

🤙
Available

Ndirangu Waweru nwaweru

🤙
Available
Block or report user

Report or block nwaweru

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
@fhdalikhan
fhdalikhan / AuthServiceProvider.php
Created Mar 26, 2019 — forked from ralphschindler/AuthServiceProvider.php
Laravel 5.8 Policy Guesser For Using "Models" Directory
View AuthServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
@jakebathman
jakebathman / logslaravel.sh
Created Aug 19, 2018
Tail Laravel logs and filter out the stack traces
View logslaravel.sh
tail -f -n 450 storage/logs/laravel*.log \
| grep -i -E \
"^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:" \
--color
View PhpStorm - Laravel Mix Alias Path Resolve Issue.js
// On PhpStorm, when ussing with laravel mix, for Alias path resolving in components you have to:
// - create a webpack.config.js file separately like:
const path = require('path')
const webpack = require('webpack')
module.exports = {
...
resolve: {
extensions: ['.js', '.json', '.vue'],
@aurawindsurfing
aurawindsurfing / cloudSettings
Last active Feb 20, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-07-27T19:36:28.740Z","extensionVersion":"v3.4.1"}
@bradtraversy
bradtraversy / sample.md
Created Mar 23, 2018
Markdown Cheat Sheet
View sample.md

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

This text is italic

View Visual Studio Code Settings For Laravel
{
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.formatOnPaste": true,
"editor.fontFamily" : "Fira Code",
"editor.fontLigatures": true,
"emmet.triggerExpansionOnTab": true,
"php.suggest.basic": false,
"editor.autoIndent": true,
"emmet.includeLanguages" : {
@mlocati
mlocati / exceptions-tree.php
Created Mar 9, 2017
Throwable and Exceptions tree
View exceptions-tree.php
<?php
if (!function_exists('interface_exists')) {
die('PHP version too old');
}
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
printTree($throwablesPerParent);
if (count($throwablesPerParent) !== 0) {
die('ERROR!!!');
@purwandi
purwandi / Controller.php
Created Jun 2, 2016
Custom error format response Lumen Framework
View Controller.php
<?php
namespace App\Http\Controllers;
use Laravel\Lumen\Routing\Controller as BaseController;
class Controller extends BaseController
{
public function __construct()
{
@JacobBennett
JacobBennett / blog.md
Last active Feb 9, 2020
API Token Authentication in Laravel 5.2 & 5.3
View blog.md

I recently had the need to write a small url shortening application. I am aware that this problem has been solved quite a few times before, but what is being a developer if not reinventing the wheel just for the heck of it? Custom CMS anyone?

Knowing that this was going to be a tiny RESTful API and also knowing that Laravel 5.2 had API rate limiting built in, I was eager to give it a try. Taylor Otwell being Taylor Otwell shipped 5.2 with the rate limiting defaults set up out of the box and I had my application building out short url's in a matter of minutes. The problem for me came when I wanted to start associating those short urls with a user.

Typically my applications have a UI and authentication is done through a simple login page. Obviously for a RESTful API, having a login page isn't ideal. Instead, my hope was to have users append an api_token to the end of their query string and use that to auth

You can’t perform that action at this time.