composer require smarty/smarty --prefer-dist dev-master
/storage/smarty
if (action.toindex < 0) return state; | |
var olditem = state.get(action.index); | |
var newlist = state.delete(action.index).insert(action.toindex, olditem); | |
return newlist; |
// Makes the scrollbar a little bit better to see. | |
atom-text-editor.editor ::-webkit-scrollbar-thumb { | |
background: #666 !important; | |
} | |
// Bidirectional text is broken, so let's pretend it doesn't exist. | |
atom-text-editor.editor .line { | |
unicode-bidi: bidi-override; | |
} |
<?php | |
// app/Providers/AppServiceProvider.php | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
public function boot() | |
{ | |
Blueprint::macro('dropIndexIfExists', function ($index) { | |
/** @var Blueprint $this */ |
<?php | |
if (!function_exists('testShadow')) { | |
/** | |
* Magically access a private or protected variable or methods from an instance of a class. | |
* Use this only in UnitTests | |
* | |
* @param mixed $instance Instance of a class | |
* @param string $name Name of the inaccessible variable or method | |
* @return mixed variable |
<?php | |
function searchByKey(array $array, $key) | |
{ | |
if (array_key_exists($key, $array)) return $array[$key]; | |
$recursive = function($chunk) use ($key, &$recursive) { | |
foreach ($chunk as $k => $v) { | |
if ($k === $key) return $chunk[$key]; | |
if (is_array($v) && $found = $recursive($v)) return $found; |
Maak een nieuwe array op basis van een groeisorteeralgoritme, begint bij de oorsprong en groeit vervolgens geleidelijk naar het begin en begin van de array.
Example use case: Loading images for a scroll animation sequence and start loading at a specific percentage
const imagesArray = [
"image1.jpg",
"image2.jpg",
Laravel Command to generate route endpoints that can be used in typescript fully threeshakable.
GenerateTypescriptRoutes.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Str;