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
// for multiple requests | |
let isRefreshing = false; | |
let failedQueue = []; | |
const processQueue = (error, token = null) => { | |
failedQueue.forEach(prom => { | |
if (error) { | |
prom.reject(error); | |
} else { | |
prom.resolve(token); |
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 | |
namespace App\Telegram\Commands; | |
use Telegram\Bot\Keyboard\Keyboard; | |
use Telegram\Bot\Commands\Command; | |
use Telegram; | |
/** | |
* Class VerifyCommand. |
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 | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use Illuminate\Filesystem\FilesystemAdapter; | |
use Barryvdh\Elfinder\ElfinderController; | |
use Barryvdh\Elfinder\Connector; | |
use Barryvdh\Elfinder\Session\LaravelSession; | |
use elFinder; |
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
$arr = []; | |
for($i = 0; $i < 10; $i++) { | |
$num_rand = num_rand(); | |
if(!in_array($num_rand, $arr)) { | |
$arr[] = $num_rand; | |
}else{ | |
$num_rand = num_rand(); | |
$arr[] = $num_rand; | |
} |
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
# /etc/network/interfaces | |
auto wlan0 | |
iface lo inet loopback | |
iface eth0 inet dhcp | |
allow-hotplug wlan0 | |
iface wlan0 inet dhcp | |
#iface wlan0 inet static |
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 uuid(){ | |
var dt = new Date().getTime(); | |
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
var r = (dt + Math.random()*16)%16 | 0; | |
dt = Math.floor(dt/16); | |
return (c=='x' ? r :(r&0x3|0x8)).toString(16); | |
}); | |
return uuid; | |
} |
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
# put this htaccess on root directory | |
<IfModule mod_rewrite.c> | |
<IfModule mod_negotiation.c> | |
Options -MultiViews | |
</IfModule> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} -d [OR] | |
RewriteCond %{REQUEST_FILENAME} -f |
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
public static function days_ago($date){ | |
$date1 = new DateTime($date); | |
$date2 = new DateTime(); | |
$interval = $date1->diff($date2); | |
if($interval->i <= 0) return "Just Now"; | |
else if($interval->h <= 0) return $interval->i . " min"; | |
else if($interval->d <= 0) return $interval->h . " hour"; | |
else if($interval->m <= 0) return $interval->d . " day"; | |
else if($interval->y <= 0) return $interval->m . " month"; |
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
class Core{ | |
//This method use for getting some string from long string. | |
private function getStringBetween(String $teks, String $sebelum, String $sesudah): String | |
{ | |
$teks = ' '.$teks; | |
$ini = strpos($teks, $sebelum); | |
if($ini == 0) return ''; | |
$ini += strlen($sebelum); | |
$panjang = strpos($teks, $sesudah, $ini) - $ini; | |
return substr($teks, $ini, $panjang); |
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
//put this in root directory of project | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ index.php/$1 [L] |
NewerOlder