This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('relations', function () { | |
$modelList = []; | |
$path = app_path() . "/Models"; | |
$results = scandir($path); | |
foreach ($results as $result) { | |
if ($result === '.' or $result === '..') continue; | |
$filename = $result; | |
if (is_dir($filename)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generates a unique local IPv6 network | |
# Based on RFC4193 https://www.rfc-editor.org/rfc/rfc4193#section-3.2.2 | |
QUIET=0 | |
while getopts :hqs: flag | |
do | |
case "${flag}" in | |
q) # Only output network prefix | |
QUIET=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Source: https://www.digitalocean.com/community/tutorials/how-to-create-and-serve-webp-images-to-speed-up-your-website#step-3-%E2%80%94-converting-jpeg-and-png-images-in-a-directory | |
# Usage ./webp-convert.sh /path/to/images | |
if [ $# -eq 0 ]; then | |
echo "Usage ./webp-convert.sh /path/to/images" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTP_ACCEPT} image/webp | |
RewriteCond %{REQUEST_URI} (?i)(.*)(\.jpe?g|\.png)$ | |
RewriteCond %{DOCUMENT_ROOT}%1.webp -f | |
RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [L,T=image/webp,R] | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header append Vary Accept env=REDIRECT_accept |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$collection = new Collection($array); | |
$perPage = 4; | |
$currentPageSearchResults = $collection->slice((LengthAwarePaginator::resolveCurrentPage() - 1) * $perPage, $perPage)->all(); | |
$paginatedSearchResults= new LengthAwarePaginator($currentPageSearchResults, count($collection), $perPage); | |
return $paginatedSearchResults; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
google-chrome --use-fake-device-for-media-stream --use-file-for-fake-video-capture=/path/to/video.y4m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dig +short myip.opendns.com @resolver1.opendns.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ywr --exclude=".git" --suppress-common-lines repo1/ repo2/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// public/index.php | |
// Wordpress / Laravel Integration | |
// Wordpress lives in public/wp/ | |
if ( file_exists(__DIR__.'/wp/index.php') ) { | |
// Retrieve the current URL | |
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/')); | |
// Get first URL segment, strip any GET params | |
$segment = strtok($segments[0], '?'); |