This file contains hidden or 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 artisan tinker | |
$translations = require resource_path('lang/en/app.php'); | |
$unused_keys = []; | |
foreach ($translations as $key => $value) { | |
// Here app is the name of the translation file | |
// that was required in first step. | |
// Replace app with the name of the translation file that is been required. |
This file contains hidden or 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 | |
namespace Database\Seeders; | |
use Illuminate\Database\Seeder; | |
use Illuminate\Support\Facades\DB; | |
class CountryTableSeeder extends Seeder | |
{ | |
/** |
This file contains hidden or 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
$builder->add('created', Filters\DateFilterType::class, array( | |
'widget' => 'single_text', | |
'label' => 'Fecha', | |
'html5' => false, | |
'attr' => ['class' => 'js-datepicker'], | |
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | |
if (empty($values['value'])) { | |
return null; | |
} |
This file contains hidden or 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
relative_urls: false, | |
remove_script_host: true, |
This file contains hidden or 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
$response = [ | |
[ | |
'position'=> 1, | |
'name' => 'Test', | |
], | |
[ | |
'position'=> 2, | |
'name' => 'Test2', | |
], | |
] |
This file contains hidden or 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 | |
telegram=(xxxxx, yyyyyy) | |
if ! pidof apache2 > /dev/null | |
then | |
# web server down, restart the server | |
echo "Server down" | |
/etc/init.d/apache2 restart > /dev/null | |
sleep 10 |
This file contains hidden or 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
//Add false as second parameter | |
$adapter = new DoctrineORMAdapter($queryBuilder, false); |
This file contains hidden or 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
function resize_crop_image($max_width, $max_height, $source_file, $dst_dir, $quality = 80) | |
{ | |
$imgsize = getimagesize($source_file); | |
$width = $imgsize[0]; | |
$height = $imgsize[1]; | |
$mime = $imgsize['mime']; | |
switch($mime){ | |
case 'image/gif': | |
$image_create = "imagecreatefromgif"; |
This file contains hidden or 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
// Function to remove folders and files | |
function rrmdir($dir) { | |
if (is_dir($dir)) { | |
$files = scandir($dir); | |
foreach ($files as $file) | |
if ($file != "." && $file != "..") rrmdir("$dir/$file"); | |
rmdir($dir); | |
} | |
else if (file_exists($dir)) unlink($dir); | |
} |
This file contains hidden or 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
document.addEventListener("DOMContentLoaded", function() { | |
var elements = document.getElementsByTagName("INPUT"); | |
for (var i = 0; i < elements.length; i++) { | |
elements[i].oninvalid = function(e) { | |
e.target.setCustomValidity(""); | |
if (!e.target.validity.valid) { | |
e.target.setCustomValidity("This field cannot be left blank"); | |
} | |
}; | |
elements[i].oninput = function(e) { |