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
{ | |
"posts": [ | |
{ | |
"userId": 1, | |
"id": 1, | |
"title": "Echo Foxtrot Golf Hotel Lima Delta Bravo November Alfa Tango Zulu Juliett Papa Romeo Kilo Mike Uniform Quebec", | |
"body": "morbi non lectus aliquam sit amet diam in magna bibendum imperdiet nullam orci pede venenatis", | |
"likes": 0, | |
"dislikes": 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
// Use connect to use Store and Dispatch | |
import { connect } from'react-redux' | |
// Use todoAction from todoAction.js | |
import { addTodo } from './todoAction' | |
/* | |
use this syntax to access the store => this.state.todos | |
component(this.state.todos) |
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\Repositories; | |
use Illuminate\Support\Str; | |
class Image { | |
public function actionImage($nameOldImage = null, $method = null) | |
{ | |
if($method = "DELETE_IMAGE"){ |
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] |
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
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
# 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
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
# /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
$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; | |
} |
OlderNewer