Skip to content

Instantly share code, notes, and snippets.

View fajars87's full-sized avatar
🌴
On vacation

Fajar Suryanto fajars87

🌴
On vacation
View GitHub Profile
@fajars87
fajars87 / CheckEmoji.php
Created October 23, 2020 07:17 — forked from hnq90/CheckEmoji.php
Check Emoji exist in string
/**
* Check emoji from string
*
* @return bool if existed emoji in string
*/
function checkEmoji($str)
{
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
preg_match($regexEmoticons, $str, $matches_emo);
if (!empty($matches_emo[0])) {
@fajars87
fajars87 / write-json-file.php
Created June 29, 2020 08:03 — forked from tutweb/write-json-file.php
Write JSON file with PHP
<?php
// array
$array = Array (
"0" => Array (
"id" => "USR1",
"name" => "Steve Jobs",
"company" => "Apple"
),
"1" => Array (
"id" => "USR2",
@fajars87
fajars87 / url_check.php
Created July 19, 2019 07:07 — forked from aalfiann/url_check.php
PHP Curl to check is url exist or not (support redirected url)
<?php
/**
* Determine that url is exists or not
*
* @param $url = The url to check
**/
function url_exists($url) {
$result = false;
$url = filter_var($url, FILTER_VALIDATE_URL);
@fajars87
fajars87 / countdown-redirect.html
Created November 1, 2018 01:41 — forked from Joel-James/countdown-redirect.html
Count Down Redirect Uisng JavaScript
<!-- Modify this according to your requirement -->
<h3>
Redirecting to duckdev.com after <span id="countdown">10</span> seconds
</h3>
<!-- JavaScript part -->
<script type="text/javascript">
// Total seconds to wait
var seconds = 10;
@fajars87
fajars87 / deploy.php
Created October 26, 2018 09:27 — forked from oxguy3/deploy.php
Script used to automatically deploy from GitHub to a cPanel shared hosting server
<?php
/**
* deploy.php by Hayden Schiff (oxguy3)
* Available at https://gist.github.com/oxguy3/70ea582d951d4b0f78edec282a2bebf9
*
* No rights reserved. Dedicated to public domain via CC0 1.0 Universal.
* See https://creativecommons.org/publicdomain/zero/1.0/ for terms.
*/
// random string of characters; must match the "Secret" defined in your GitHub webhook
@fajars87
fajars87 / LoginController.php
Created April 2, 2018 16:11 — forked from SaeedPrez/LoginController.php
Laravel 5.4 Additional Login Conditions - Add custom error message.
<?php
// This is code to return custom error message
// for Youtube tutorial: Laravel 5.4 Additional Login Conditions
// https://www.youtube.com/watch?v=Z8s6uhhD1Pk
namespace App\Http\Controllers\Auth;
@fajars87
fajars87 / laravel-[.htaccess]
Created January 31, 2018 09:26 — forked from iwebroot/laravel-[.htaccess]
[Fix error : 500] : Multiple laravel projects in shared hosting
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
### Add two lines for fix error 500 ###
Options -Indexes
php_flag xcache.cacher 0
@fajars87
fajars87 / Base64Encode-Decode.php
Created December 13, 2017 03:06 — forked from nirendra/Base64Encode-Decode.php
Base64 Encode and Decode String in PHP
function base64url_encode($plainText) {
$base64 = base64_encode($plainText);
$base64url = strtr($base64, '+/=', '-_,');
return $base64url;
}
function base64url_decode($plainText) {
$base64url = strtr($plainText, '-_,', '+/=');
$base64 = base64_decode($base64url);
return $base64;
@fajars87
fajars87 / ionic-action-sheet-android.css
Created November 10, 2017 06:29 — forked from chonz0/ionic-action-sheet-android.css
Ionic: nicer styles for action sheet in Android
/*
* Credits to https://forum.ionicframework.com/t/actionsheets-android-ugly-styling-need-help/18462/12
*/
.platform-android .action-sheet-backdrop.active {
background-color: rgba(0, 0, 0, 0.1);
}
.platform-android .action-sheet {
align-content: center;
margin: auto;
max-width: 96vw;
@fajars87
fajars87 / kode_pos.php
Created November 6, 2017 10:02 — forked from bachors/kode_pos.php
Membuat API kode POS Indonesia
<?php
/* Just 4 Fun
API kode POS Indonesia
by iBacor.com */
function kode_pos($q){
// array untuk output
$result = array();