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
/* | |
Just add this JS code in you HTML however you want. it will check all kinds of AdBlocker with JS | |
*/ | |
var adBlockEnabled = false; | |
var testAd = document.createElement('div'); | |
testAd.innerHTML = ' '; | |
testAd.className = 'adsbox'; | |
document.body.appendChild(testAd); | |
window.setTimeout(function() { | |
if (testAd.offsetHeight === 0) { |
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 | |
/* | |
* Resize images dynamically using wp built in functions | |
* @author Victor Teixeira | |
* @link http://core.trac.wordpress.org/ticket/15311 | |
* | |
* php 5.2+ | |
* | |
* Exemple use: |
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 | |
// php >= 7.0 | |
function paginate ($total, $per_page, $curr_page) | |
{ | |
$url = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; | |
$result = []; | |
$result['html'] = '<div class="pagination">'; | |
$result['offset'] = ($curr_page - 1) < 0 ? 0 : ($curr_page - 1) * $per_page ; | |
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
function dynamic_image($url, $width = false, $height = -1, $quality = 80, $compression = 75) | |
{ | |
$parsed = parse_url($url); | |
$path = $parsed['path']; | |
$file_name = basename($path); | |
$only_path = str_replace($file_name, '', $path); | |
$public_path = public_path($path); | |
if(file_exists($public_path)) |
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 CopyText = function() { | |
let t; | |
const e = function(e) { | |
t || (t = document.createElement("textarea"), document.body.appendChild(t)), t.value = e, t.setAttribute("readonly", "true"), t.setAttribute("type", "text"), t.select(), t.setSelectionRange(0, 9999); | |
try { | |
return document.execCommand("copy"), !0 | |
} catch (t) { | |
return !1 | |
} finally { | |
t.setAttribute("type", "hidden") |
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
/* | |
<pagination | |
:current="files.current_page" | |
:total="files.total" | |
:per-page="files.per_page" | |
@page-changed="get_results" | |
/> | |
*/ | |
<template> | |
<div class="text-center"> |
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
if(data && data.response && data.response.data && data.response.data.errors) | |
{ | |
for (const error in data.response.data.errors) | |
{ | |
data.response.data.errors[error].forEach(err2 => { | |
createToast(err2, {type: 'danger'}) | |
}) | |
} | |
}else | |
if(data && data.response && data.response.data && data.response.data.message) |
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
let data = new FormData(); | |
data.append('file', file, file.name); | |
axios.post( | |
URL, | |
data, | |
{ | |
headers: { | |
'accept': 'application/json', | |
'Accept-Language': 'en-US,en;q=0.8', |
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
// Route | |
Route::any('/dynamic/route/{class}/{method}', function ($class, $method) { | |
$class = "\App\Http\Controllers\\" . str_replace('-', "/", $class); | |
$con = new $class(); | |
return $con->$method(); | |
})->name('dynamic.route'); | |
// JS | |
global.route2 = (classAndMethodName, params = {}) => { | |
let array = classAndMethodName.split('@') |
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
function generate_slug($modelClass, $modelColumnName, $title) | |
{ | |
$slug = \Illuminate\Support\Str::slug($title); | |
$slugCount = count( $modelClass::whereRaw($modelColumnName . " REGEXP '^{$slug}(-[0-9]*)?$'")->get() ); | |
return ($slugCount > 0) ? "{$slug}-{$slugCount}" : $slug; | |
} |
OlderNewer