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
Instead of if and isset, directly isset Laravel v5.4 | |
@isset($aVar) | |
// if (isset($aVar)) | |
@else | |
// else | |
@endisset | |
Loops |
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 | |
// #1 - Install laravel: https://laravel.com/docs/5.5#installation | |
/* $console/bash/cmd commands > | |
$> composer global require "laravel/installer" | |
$> laravel new excel_to_db_project | |
$> cd excel_to_db_project | |
// #2 - Install excel package, documentation on: https://github.com/Maatwebsite/Laravel-Excel if laravel >5.5 no need to do nothing | |
$> composer require "maatwebsite/excel" | |
*/ |
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 | |
public function beforeFind($event, $query, $options, $primary) | |
{ | |
// if query builder have ->applyOptions(['default' => false]) not use default conditions and return query | |
if (isset($options['default']) && $options['default'] == false) { | |
return $query; | |
} | |
// default conditions |
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
# delete local tag '12345' | |
git tag -d 12345 | |
# delete remote tag '12345' (eg, GitHub version too) | |
git push origin :refs/tags/12345 | |
# alternative approach | |
git push --delete origin tagName | |
git tag -d tagName |
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
// Message to be displayed on unload | |
var message = $('#jtrnslt #leavemess').text(), submitting = false; | |
// On Form submition set submitting to true for not fire onbeforeunload | |
$(document).on("submit", "form", function(event){ | |
submitting = true; | |
}); | |
// Window onbeforeunload fired when leave page but not if it a form submition or element with .noBeforeUnload class | |
window.onbeforeunload = function (e) { | |
e = e || window.event; | |
// Determine if you want to allow unload |
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
<script> | |
/** | |
* Boxes AutoHeight | |
* | |
* @param columns | |
* | |
* data-weh-add="50" add 50px to all | |
*/ | |
function withEqualHeight(columns) { | |
var tallestcolumn = 0, add = parseInt(columns.first().attr('data-weh-add')); |
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 | |
/* | |
* spesso abbiamo bisogno di parametri default obbligatori | |
* ma che possono essere sovrascritti con quelli custom passati alla funzione ad ogni chiamata | |
* ... la suluzione in 4 righe e' questa | |
* --- | |
* [EN] often we need a mandatory options parameters that can be overriden by custom params passed each time | |
* the solution is here in 4 rows of code | |
*/ |
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
# 0 - Before any rule check for mod-rewrite module existance and enable it | |
<IfModule mod_rewrite.c> | |
# Enable before other rules | |
RewriteEngine On | |
</IfModule> | |
# Redirect Trailing Slashes If Not A Folder... | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} (.+)/$ | |
RewriteRule ^ %1 [L,R=301] |
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
<!-- 1 --> | |
<a href="#" id="totop">TOP</a> | |
<script> | |
if ($('#totop').length) { | |
var scrollTrigger = 100, // px | |
backToTop = function () { | |
var scrollTop = $(window).scrollTop(); | |
if (scrollTop > scrollTrigger) { | |
$('#totop').addClass('show'); | |
} else { |
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
<table class="data myne_kol" style="width:450px"> | |
<caption> | |
Tabella dei Cursori CSS | |
</caption> | |
<tbody><tr> | |
<th>Cursore</th> | |
<th>Valore CSS</th> | |
<th>Esempio</th> | |
</tr> |