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
Public Function URLEncode(StringToEncode As String, Optional _
UsePlusRatherThanHexForSpace As Boolean = False) As String
Dim TempAns As String
Dim CurChr As Integer
CurChr = 1
Do Until CurChr - 1 = Len(StringToEncode)
Select Case Asc(Mid(StringToEncode, CurChr, 1))
Case 48 To 57, 65 To 90, 97 To 122
TempAns = TempAns & Mid(StringToEncode, CurChr, 1)
@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 / index.html
Created May 8, 2020 01:45
Radio Selects: Flexbox and Fun
<p>Haven't finish this yet but, boy, what fun it's been!</p>
<h1>New Game</h1>
<h2>Select difficulty&hellip;</h2>
<section>
<div>
<input type="radio" id="control_01" name="select" value="1" checked>
<label for="control_01">
<h2>Pfft</h2>
<p>Awww, poor baby. Too afraid of the scary game sprites? I laugh at you.</p>
</label>
@fajars87
fajars87 / REGEX coordinate.txt
Created December 9, 2019 06:20
regex coordinate maps
Regex for coordinate maps: /(-?\d+\.\d+),(-?\d+\.\d+)/
example:
https://www.google.com.au/maps/place/Douglas+Park/@-34.1909818,150.7130019,15.5z/data=!4m2!3m1!1s0x6b12fc6f59d70d01:0x1d0609b5909b97b0
https://www.google.com.au/maps/@-34.2078481,150.7163248,13.5z
@fajars87
fajars87 / Timer.jsx
Created October 16, 2019 12:42
Countdown Clock (timer) - After Effects Expression
rate = -1;
clockStart = 300.00;
sign = "";
function padZero(n) {
if (n < 10) {
return "0" + n
}
else {
return "" + n
}
function findLongestStringFromArray($array = array()) {
if(!empty($array)){
$lengths = array_map('strlen', $array);
$maxLength = max($lengths);
$key = array_search($maxLength, $lengths);
return $array[$key];
}
}
while($hasil=mysqli_fetch_array($data)){
$cellWidth=20; //lebar sel
$cellHeight=1; //tinggi sel satu baris normal
//periksa apakah teksnya melibihi kolom?
if($pdf->GetStringWidth($hasil['pesan']) < $cellWidth){
//jika tidak, maka tidak melakukan apa-apa
$line=1;
}else{
//jika ya, maka hitung ketinggian yang dibutuhkan untuk sel akan dirapikan
@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);