Skip to content

Instantly share code, notes, and snippets.

View barokurniawan's full-sized avatar

Asep Oo Kurniawan barokurniawan

  • Tasikmalaya, Indonesia
View GitHub Profile
@barokurniawan
barokurniawan / ObjectScanner.php
Last active January 31, 2023 04:57
Convert PHP array or PHP Plain Object to PHP Class Entity
<?php
use ReflectionClass;
/**
* Scan database result into entity class
* Data member of the entity class should exactly match with the database result column
*
*/
class ObjectScanner
@barokurniawan
barokurniawan / Helper.php
Created August 23, 2021 00:29
Convert nested object into nested array
<?php
use ReflectionClass;
class Helper
{
public static function toRupiah($number, bool $withPrefix = true)
{
return ($withPrefix ? "Rp " : "") . number_format($number, 0, ",", ".");
}
@barokurniawan
barokurniawan / uniqid.js
Created October 27, 2020 16:07
uniqid.js just like uniqid in PHP
function uniqid(a = "",b = false){
var c = Date.now()/1000;
var d = c.toString(16).split(".").join("");
while(d.length < 14){
d += "0";
}
var e = "";
if(b){
e = ".";
@barokurniawan
barokurniawan / ContainerNumber.php
Created February 22, 2020 06:18
Check ISO Container Number
<?php
class ContainerNumber
{
private array $charMap;
private string $containerNumber;
public function __construct(string $containerNumber)
{
$this->setContainerNumber($containerNumber);
@barokurniawan
barokurniawan / CurencyLang.php
Created January 8, 2020 13:03
PHP Terbilang dalam bahasa inggris
<?php
class CurencyLang
{
static function toEnglish($number)
{
$hyphen = '-';
$conjunction = ' and ';
$separator = ', ';
$negative = 'negative ';
@barokurniawan
barokurniawan / media-query.css
Created January 2, 2020 07:01 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS