Skip to content

Instantly share code, notes, and snippets.

View ronaldaug's full-sized avatar
💻
Working from home

Ronald ronaldaug

💻
Working from home
View GitHub Profile
@ronaldaug
ronaldaug / uid.md
Created April 20, 2020 07:17
PHP Unique ID

UUID

echo bin2hex(random_bytes(5));
@ronaldaug
ronaldaug / vtoast.md
Last active May 25, 2022 09:32
Simple Toast Plugin For Your Web App

Simple Alert Message For Your Web App

View Source Codes
class VToast{
  constructor(options){
      this.defaultOption = {
          duration:2000,
@ronaldaug
ronaldaug / sim-test-tut5.md
Created April 7, 2020 02:27
Create a new Todo
/**
 * Protected routes
 */
if($auth->routes()){

          /**
          * Post request
 */
@ronaldaug
ronaldaug / sim-rest-tut4.md
Last active April 7, 2020 04:14
index.php routes example
<?php

require('App.php');

/**
 * Public routes
 */

/**
@ronaldaug
ronaldaug / sim-rest-tut3.md
Last active April 7, 2020 01:31
Config.php example
<?php 
        if(!defined('sim-rest')){ exit;}         
        header('Content-Type: application/json');
?>
{
    "admins": [
        {
            "username": "admin1",
 "password": "admin1",
@ronaldaug
ronaldaug / sim-rest-tut2.md
Created April 7, 2020 01:23
Todo collection example
<?php 
        if(!defined('sim-rest')){ exit;}         
        header('Content-Type: application/json');
?>

{
        "todos": []
}
@ronaldaug
ronaldaug / sim-rest-tut1.md
Last active April 5, 2020 14:54
sim-rest - declare simple route
$router->get('/test',function(){
  
      $message  = "Hello, you've just opened '/test' route";
      $response = [
             "status"  => 200,
             "message" => $message
      ];
      echo json_encode($response);
})
@ronaldaug
ronaldaug / paginate.md
Last active December 17, 2020 12:37
Pagination Logic

Pagination Logic

export class Pagination {

    constructor() {
        // current page
        this.current;
        // all items total
        this.total;
    }
@ronaldaug
ronaldaug / preview.md
Last active December 22, 2019 14:20
Preview image as data before upload

HTML

<input type="file" accept="image/*" onchange="loadFile(event)">
<img id="output"/>

Javascript

var loadFile = function(event) {
 var reader = new FileReader();