Skip to content

Instantly share code, notes, and snippets.

💭
Sul pezzo

Artur arturmamedov

💭
Sul pezzo
Block or report user

Report or block arturmamedov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arturmamedov
arturmamedov / w-whatsapp.js
Created May 16, 2019
WhatsApp Api on Mobile and Desktop
View w-whatsapp.js
/**
* 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 / bootstrap4-media-breakpoints.css
Created May 6, 2019 — forked from withArtur/bootstrap4-media-breakpoints.css
Bootstrap 4 all media query breakpoints (xs,sm,md,lg,xl) up to, down from, only
View bootstrap4-media-breakpoints.css
/**
* Bootstrap 4 all media queries #wMQ
* up > sm, md, lg, xl
* down < sm, md, lg
* only = xs, sm, lg, xl
* between <> sm-lg, sm-xl, md-xl
*/
/* .xs = | Extra Small devices only (portrait phones) less than 576px */
View traffic_sources_cookies.js
// configuration
var $hostname = '.sviluppo1.loc',
cookie_params = ['source', 'medium', 'campaign']; // there are also [... 'term', 'content'] !commented
function crumbleCookie(a) {
for (var d = document.cookie.split(";"), c = {}, b = 0; b < d.length; b++) {
var e = d[b].substring(0, d[b].indexOf("=")).trim(),
i = d[b].substring(d[b].indexOf("=") + 1, d[b].length).trim();
c[e] = i;
}
@arturmamedov
arturmamedov / ga_referrer-analytics.js
Created Jan 30, 2019
Google Analytics (analytics.js) get referral `ga_referrer`
View ga_referrer-analytics.js
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});
}
View detectmobilebrowser.js
/**
* 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 / standalonepopup.html
Last active Jul 24, 2018
elFinder standalonepopup in a new browser window (not modal, colorbox etc.)
View standalonepopup.html
<!-- main.html (html input and js for open new window with elFinder for select file) -->
<input type="text" class="form-control" value="" id="idOfInput" onfocus="return openElFinder(event, 'idOfInput');"/>
<script>
$( document ).ready(function() {
window.input_id = '';
window.openElFinder = function (event, input_id) {
event.preventDefault();
window.single = true;
@arturmamedov
arturmamedov / laravel_db_to_excel.php
Created Feb 14, 2018
Select Eloqeunt models, filter it and transfrom for export in xls with custom format to
View laravel_db_to_excel.php
<?php
// refer for this gist for first steps that are trhe same: https://gist.github.com/arturmamedov/0b2e5b7e39c7e1de8fc09f69f79db618
$parent_id = '1';
// select all children sites
$sites = Site::where('parent_id', $parent_id)->get();
//dd($sites);
$children_id = $sites->pluck('id');
//dd($children_id);
View tips.blade.php
Instead of if and isset, directly isset Laravel v5.4
@isset($aVar)
// if (isset($aVar))
@else
// else
@endisset
Loops
@arturmamedov
arturmamedov / laravel_excel_to_db.php
Last active Jan 26, 2018
install `laravel`, install `maatwebsite/excel` and import data from excel to db table
View laravel_excel_to_db.php
<?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"
*/
@arturmamedov
arturmamedov / ResourcesTable.php
Created Oct 13, 2017
CakePHP - beforeFind() callback with default conditions and possibility to disable it
View ResourcesTable.php
<?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
You can’t perform that action at this time.