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
/* | |
After loading this js,Do Smething like this: | |
if(typeof blockAdBlock === 'undefined') { | |
adBlockDetected(); | |
} else { | |
blockAdBlock.onDetected(adBlockDetected); | |
blockAdBlock.onNotDetected(adBlockNotDetected); | |
// and|or | |
blockAdBlock.on(true, adBlockDetected); | |
blockAdBlock.on(false, adBlockNotDetected); |
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
$data = [ | |
'India'=>73, | |
'United States'=>74, | |
'United Kingdom'=> 75, | |
'Singapore'=>77, | |
'Australia'=>87, | |
'Canada'=>102 | |
]; | |
uksort($data, function($a, $b) { | |
return strcmp($a, $b); |
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 | |
$countries = array( | |
"AF" => array( 'alpha2'=>'AF', 'alpha3'=>'AFG', 'num'=>'004', 'isd'=> '93', "name" => "Afghanistan", "continent" => "Asia", ), | |
"AX" => array( 'alpha2'=>'AX', 'alpha3'=>'ALA', 'num'=>'248', 'isd'=> '358', "name" => "Åland Islands", "continent" => "Europe"), | |
"AL" => array( 'alpha2'=>'AL', 'alpha3'=>'ALB', 'num'=>'008', 'isd'=> '355', "name" => "Albania", "continent" => "Europe"), | |
"DZ" => array( 'alpha2'=>'DZ', 'alpha3'=>'DZA', 'num'=>'012', 'isd'=> '213', "name" => "Algeria", "continent" => "Africa"), | |
"AS" => array( 'alpha2'=>'AS', 'alpha3'=>'ASM', 'num'=>'016', 'isd'=> '1684', "name" => "American Samoa", "continent" => "Oceania"), | |
"AD" => array( 'alpha2'=>'AD', 'alpha3'=>'AND', 'num'=>'020', 'isd'=> '376', "name" => "Andorra", "continent" => "Europe"), | |
"AO" => array( 'alpha2'=>'AO', 'alpha3'=>'AGO', 'num'=>'024', 'isd'=> '244', "name" => "Angola", "continent" => "Africa"), | |
"AI" => array( 'alpha2'=>'AI', 'alpha3'=>'AIA', |
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
$file = $req->file('picture'); | |
$old = public_path($user->getAttributes()['picture']); | |
if( | |
$old && | |
is_file($old) | |
) | |
{ | |
unlink($old); | |
} | |
$name = $user->id .'-picture.' . $file->getClientOriginalExtension(); |
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::any('/dynamic/route/{class}/{method}', function ($class, $method) { | |
$class = "\App\Http\Controllers\\" . str_replace('-', "/", $class); | |
// return $class; | |
$con = new $class(); | |
return $con->$method(); | |
})->name('dynamic.route'); | |
global.route2 = (classAndMethodName, params = {}) => { | |
let array = classAndMethodName.split('@') | |
params.class = array[0].replace(/\\/g, '-') |
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; | |
} |
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
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
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
/* | |
<pagination | |
:current="files.current_page" | |
:total="files.total" | |
:per-page="files.per_page" | |
@page-changed="get_results" | |
/> | |
*/ | |
<template> | |
<div class="text-center"> |
NewerOlder