Skip to content

Instantly share code, notes, and snippets.

View arturmamedov's full-sized avatar
💭
Sul pezzo

Artur arturmamedov

💭
Sul pezzo
View GitHub Profile
@arturmamedov
arturmamedov / w-whatsapp.js
Created May 16, 2019 12:29
WhatsApp Api on Mobile and Desktop
/**
* Replace mobile URL of WhatsApp with Desktop
* The mobile first strategy is used cause most people decide to not show WhatsApp on Desktop but only on mobile where it is very useful
*
* @dependencies [ core/w-ismobile.js ]
*/
if(withOptions.whatsappWeb && !jQuery.browser.mobile && $(".whatsapp-weburl").length > 0){
clog('WhatsApp Enabled and Present');
clog($(".whatsapp-weburl"));
@arturmamedov
arturmamedov / AJS-jQ_showhide.html
Last active April 9, 2019 08:28
AngularJS show /hide VS jQuery show/hide.
<!-- AngularJS ng-show and ng-click -->
<div class="checkbox">
<label ng-click="show = !show">
<input type="radio" name="cat_id" value="1">
<strong>Residenziale</strong> Immobili in vendita oppure in affitto<br>
</label>
<span ng-show="show">
<label class="checkbox-inline">
<input type="radio" value="A" name="res_sell_type">
@arturmamedov
arturmamedov / merge_options.php
Last active February 12, 2019 10:34
Merge $defaults with custom passed $options
<?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
*/
@arturmamedov
arturmamedov / am-bs.css
Last active February 1, 2019 10:50
My Custom Miscellaneous CSS style, bootstrap compattible
/* OVERWRITED */
.modal-footer {margin-top:0px;}
.center-block {
float:none;
}
/* Tables * /
.table-striped > thead > tr {
background-color: #D196A4;
@arturmamedov
arturmamedov / laravel_log_daily_email_ip_conf.php
Last active February 1, 2019 10:49 — forked from reedmaniac/Laravel Logging - Customization
Laravel Logger configuration for Daily logs, Email send on Warning Level, and optionally (comment out and add on setFormatter()) HTML Formater
<?php
// Put at the top of ./config/app.php
// Custom Monolog Configuration - https://laravel.com/docs/5.2/errors#configuration
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Illuminate\Mail\TransportManager;
$app->configureMonologUsing(function($monolog) use ($app) {
@arturmamedov
arturmamedov / ga_referrer-analytics.js
Created January 30, 2019 15:39
Google Analytics (analytics.js) get referral `ga_referrer`
ga(function(tracker) {
var ga_refferer = tracker.get('referrer'); // this get the referral from google analytics.js
if (typeof wCookies != 'undefined' && typeof wCookies().get('ga_refferer') == 'undefined') {
if (typeof ga_refferer != 'undefined') {
wCookies().set('ga_refferer', ga_refferer, {expires: 30});
} else {
wCookies().set('ga_refferer', 'direct', {expires: 30});
}
/**
* jQuery.browser.mobile (http://detectmobilebrowser.com/)
*
* jQuery.browser.mobile will be true if the browser is a mobile device
*
**/
(function (a) {
(jQuery.browser = jQuery.browser || {}).mobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(
@arturmamedov
arturmamedov / tips.blade.php
Last active June 26, 2018 14:08
Blade tips
Instead of if and isset, directly isset Laravel v5.4
@isset($aVar)
// if (isset($aVar))
@else
// else
@endisset
Loops
@arturmamedov
arturmamedov / ResourcesTable.php
Created October 13, 2017 09:40
CakePHP - beforeFind() callback with default conditions and possibility to disable it
<?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
@arturmamedov
arturmamedov / to-top.html
Created November 22, 2016 09:50
To top JS and HTML
<!-- 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 {