Skip to content

Instantly share code, notes, and snippets.


Sergey NBZ4live

  • B.V.
  • Amsterdam
View GitHub Profile
NBZ4live / 2018_02_07_101510_migrate_to_utf8mb4.php
Created Feb 7, 2018
Laravel migration to migrate the database from utf8 to utf8mb4
View 2018_02_07_101510_migrate_to_utf8mb4.php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MigrateToUtf8mb4 extends Migration
* Run the migrations.
NBZ4live /
Created Feb 16, 2020
Rust config_struct crate build script with check for the existence of the config file
use config_struct::{Error, StructOptions};
use std::fs;
const CONFIG_FILE_DST: &str = "src/";
fn main() -> Result<(), Error> {
let mut config_file_src = "config.toml";
NBZ4live / LumenAdapter.php
Created Mar 6, 2018
PHP-PM Lumen adapter
View LumenAdapter.php
namespace App\PHPPM;
use Illuminate\Container\BoundMethod;
use Illuminate\Support\ServiceProvider;
use PHPPM\Bootstraps\Laravel;
class LumenAdapter extends Laravel
NBZ4live / tinker_script.php
Last active Jun 13, 2018
Print MySQL Grants for all not working connections configured in Laravel
View tinker_script.php
$userHost = '%';
foreach(config('database.connections') as $name => $connection) {
if ($connection['driver'] != 'mysql') {
try {
} catch(\Doctrine\DBAL\Driver\PDOException $exception) {
NBZ4live / clone.blade.php
Created Feb 10, 2018
Laravel backpack clone button. (resources/views/vendor/backpack/crud/buttons/custom/clone.blade.php)
View clone.blade.php
@if ($crud->hasAccess('create'))
@php($parameters = [])
@php($attributes = collect($entry->getAttributes()))
@foreach($crud->getFields('create') as $field)
@php($parameters[$field['name']] = $attributes->get($field['name']))
View WoltlabSuiteValetDriver.php
class WoltlabSuiteValetDriver extends BasicValetDriver
* Determine if the driver serves the request.
* @param string $sitePath
* @param string $siteName
* @param string $uri
NBZ4live / CrudController.php
Created Mar 5, 2017
Simple Laravel Backpack text filter for a single field
View CrudController.php
<?php /** app/Http/Controllers/CrudController.php **/
namespace App\Http\Controllers;
use Illuminate\Http\Response;
class CrudController extends \Backpack\CRUD\app\Http\Controllers\CrudController
public function setUp()
View clear-apc.php
#!/usr/bin/env php
Copyright 2013 Stuart Carnie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to