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 timeLeft($future) // $original should be the future date and time in unix format | |
{ | |
date_default_timezone_set('Asia/Jakarta'); | |
// Common time periods as an array of arrays | |
$periods = array( | |
array(60 * 60 * 24 * 365 , 'Y'), | |
array(60 * 60 * 24 * 30 , 'M'), | |
array(60 * 60 * 24 * 7, 'W'), | |
array(60 * 60 * 24 , 'D'), | |
array(60 * 60 , 'H'), |
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 | |
function kekata($x) { | |
$x = abs($x); | |
$angka = array("", "satu", "dua", "tiga", "empat", "lima", | |
"enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas"); | |
$temp = ""; | |
if ($x <12) { | |
$temp = " ". $angka[$x]; | |
} else if ($x <20) { | |
$temp = kekata($x - 10). " belas"; |
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
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions(); | |
//MISC | |
$miscPermission = Permission::create(['name' => 'N/A']); | |
//USER MODEL | |
$userPermission1 = Permission::create(['name' => 'create: user']); | |
$userPermission2 = Permission::create(['name' => 'read: user']); | |
$userPermission3 = Permission::create(['name' => 'update: user']); | |
$userPermission4 = Permission::create(['name' => 'delete: user']); |
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
$path = storage_path() . "/json/phone_country.json"; | |
$phone_country = json_decode(file_get_contents($path), true); | |
$phone = ''; | |
foreach ($phone_country as $country) { | |
$pos = strpos($this->email, $country['dial_code']); | |
if ($pos !== false) { | |
$phone = str_replace($country['dial_code'],'', $this->email); | |
} | |
} |
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 | |
/* | |
* Place this with the rest of your rules. | |
* Doesn't need to be in an array as there are no pipes. | |
* Password is required with a minimum of 6 characters | |
* Should have at least 1 lowercase AND 1 uppercase AND 1 number | |
*/ | |
$rules = [ | |
'password' => 'required|min:6|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$/' | |
]; |
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
h1 { | |
display: block; | |
font-size: 2em; | |
margin-top: 0.67em; | |
margin-bottom: 0.67em; | |
margin-left: 0; | |
margin-right: 0; | |
font-weight: bold; | |
} | |
h2 { |
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
curl -O https://wordpress.org/latest.zip | |
unzip latest.zip | |
mv wordpress site | |
rm latest.zip |
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
<link rel='manifest' href='/manifest.json'> | |
<script> | |
// Check compatibility for the browser we're running this in | |
if ("serviceWorker" in navigator) { | |
if (navigator.serviceWorker.controller) { | |
console.log("[PWA Builder] active service worker found, no need to register"); | |
} else { | |
// Register the service worker | |
navigator.serviceWorker |
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
protected function mapAmpRoutes() | |
{ | |
Route::group([ | |
'middleware' => 'web', | |
'namespace' => $this->namespace, | |
'prefix' => 'amp', | |
], function ($router) { | |
require base_path('routes/amp.php'); | |
}); | |
} |
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
package com.madindo.fotofilio; | |
import android.content.Intent; | |
import android.os.Handler; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
public class MainActivity extends AppCompatActivity { | |
private static int SPLASH_TIME_OUT = 4000; |
NewerOlder