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
<?php | |
// Create a screenshot | |
exec("ffmpeg -ss $secondId -i $videoUrl -ss 0 -frames:v 1 $directory/$secondId.jpg"); | |
// Create a six-second video screenshot | |
exec("ffmpeg -y -i $videoUrl -ss " . ($secondId - 3) . " -t 6 -crf 18 -threads 1 $directory/$secondId.mp4"); | |
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
<?php | |
$array = [12, 0, 8, 1, 0, 39, 0, 7]; | |
$searchedValue = 0; | |
$j=0; | |
for ($i=0; $i< count($array); ++$i) { | |
if ($array[$i] !== $searchedValue) { | |
if ($i !== $j && $array[$j] === $searchedValue) { | |
$array[$j] = $array[$i]; |
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
<?php | |
// Create an array and hide a value in it | |
$mySearchedValue = rand(0, 100); | |
$array = array_merge( | |
array_map(static function () { | |
return rand(0, 100); | |
}, array_fill(0, rand(9, 13), null)), | |
[$mySearchedValue], |
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 | |
HOST_NAME=XXXX | |
USER=XXXX | |
PASSWORD=XXXX | |
DATABASE_NAME=XXXX | |
DB_FILE=export.sql | |
EXCLUDED_TABLES=( | |
table1 | |
table2 |
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
<?php | |
$foo = 'foo'; | |
$functions = [ | |
'function1' => function ($bar) use ($foo) { | |
return $foo . $bar; | |
}, | |
'function2' => fn ($bar) => $foo . $bar | |
]; | |
foreach ($functions as $function) { |
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
const config = require('../config') | |
const RedisClient = require('./redis-client.js') | |
const sequelizeCache = require('./sequelize-cache') | |
class AbstractRepository { | |
/** | |
* Constructor, allows to use model directly in repository methods | |
* @param {Object} model | |
*/ | |
constructor (model) { |
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
#!/usr/bin/env bash | |
php -d memory_limit=-1 artisan cache:clear | |
php -d memory_limit=-1 artisan config:clear | |
php -d memory_limit=-1 artisan config:cache | |
php -d memory_limit=-1 artisan route:clear | |
php -d memory_limit=-1 artisan route:cache | |
APP_URL=$(grep APP_URL .env | cut -d '=' -f2) | |
APP_ENV=$(grep APP_ENV .env | cut -d '=' -f2) |
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
<?php | |
use Storage; | |
$file = 'route/to/file.mp4'; | |
$dirThumbnails = 'folder/for/thumbnails'; | |
$thumbnailGroupQuantity = 60; | |
$thumbnailLineQuantity = 6; | |
$secondsBetweenTwoThumbnails = 5; |
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 | |
usage() { | |
printf "Usage:\n$0\n[-t (type of content) url|folder]\n[-u (url to purge) ex: https://xxx.yyy.com/logo.png]" 1>&2; | |
exit 1; | |
} | |
purgeUrl="https://api.cdnetworks.com/ccm/purge/ItemIdReceiver" | |
# data stored in a .env file | |
username=$(grep CDNETWORKS_USERNAME .env | cut -d '=' -f2) |