Skip to content

Instantly share code, notes, and snippets.

@franzliedke
franzliedke / about.md
Created August 31, 2012 19:41 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@franzliedke
franzliedke / routes.php
Created January 18, 2013 00:11
Laravel 4: Redirect URLs with trailing slashes to the variant without.
<?php
Route::get('{any}', function($url) {
return Redirect::to(mb_substr($url, 0, -1), 301);
})->where('any', '(.*)\/$');
@franzliedke
franzliedke / README.md
Created June 9, 2013 13:27
FluxBB Authentication Plugin for DokuWiki

Installation

In your DokuWiki installation, create a folder lib/plugins/authfluxbb/ and create the two files auth.php and plugin.info.txt in it.

In your wiki's conf/local.protected.php (create this file if it does not exist), add the following lines:

$conf['authtype'] = 'authfluxbb';
$conf['superuser'] = '@Administrators,@Moderators';

// Make sure stripping slashes doesn't clash with the forums.

@franzliedke
franzliedke / Group.php
Last active August 29, 2015 14:04
FluxBB Eloquent models
<?php
class Group extends Eloquent
{
protected $table = 'groups';
public function users()
{
return $this->hasMany('User', 'group_id');
}
@franzliedke
franzliedke / WebGroup.php
Created December 10, 2015 19:44
Composite Middleware
<?php
use Illuminate\CompositeMiddleware;
class WebGroup extends CompositeMiddleware
{
protected $middlewares = [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
@franzliedke
franzliedke / SomeModel.php
Created March 1, 2016 12:52
Laravel scope with binding
<?php
class SomeModel extends Eloquent
{
public function scopeSomething(Builder $query, $something)
{
// This will properly set up a binding
return $query->where('something', $something);
}

Keybase proof

I hereby claim:

  • I am franzliedke on github.
  • I am franzliedke (https://keybase.io/franzliedke) on keybase.
  • I have a public key ASCIl-d4IqRn--938agJUfKwIrfZIE3AuWWMxb2Jmh5_2wo

To claim this, I am signing this object:

@franzliedke
franzliedke / benchmark.php
Created August 31, 2018 12:01
Benchmark Laravel's pluck() method
<?php
require 'vendor/autoload.php';
use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'mysql',