Skip to content

Instantly share code, notes, and snippets.

View helloworldlab's full-sized avatar
🏠
Working from home

Hello World Lab helloworldlab

🏠
Working from home
  • Hello World Lab
  • Perak, Malaysia
View GitHub Profile
@helloworldlab
helloworldlab / ExampleController.php
Created September 15, 2023 15:03 — forked from xavier83ar/ExampleController.php
Export big data volumes. PHP + CakePHP (3-4) + CSV
<?php
/**
* Created by javier
* Date: 23/4/21
* Time: 18:35
*/
namespace App\Controller;
/**
@helloworldlab
helloworldlab / AppServiceProvide.php
Last active July 21, 2025 22:06
Install Bootstrap 5.3 on Laravel
<?php
Component::macro(
'notifikasi',
function ($tajuk = null, $isiKandungan = null, $tindakan = null) {
$js = '';
if (filled($tajuk)) {
$js .= "document.getElementById('tajuk-notifikasi-sistem').innerHTML = '';";
$js .= "document.getElementById('tajuk-notifikasi-sistem').innerHTML = '{$tajuk}';";
@helloworldlab
helloworldlab / customize-scrollbar.css
Created March 18, 2022 04:07 — forked from spemer/customize-scrollbar.css
✨ Customize website's scrollbar like Mac OS. Not supports in Firefox and IE.
/* Customize website's scrollbar like Mac OS
Not supports in Firefox and IE */
/* total width */
body::-webkit-scrollbar {
background-color: #fff;
width: 16px;
}
/* background of the scrollbar except button or resizer */
@helloworldlab
helloworldlab / note.txt
Created December 27, 2021 02:39 — forked from rksk/note.txt
MySQL: Logging table changes into another table using triggers
This is related to the blog post: https://medium.com/p/5215c77083e5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Table</title>
<style>
* {
font-family: Arial, Helvetica, sans-serif;
@helloworldlab
helloworldlab / encryption.php
Created December 21, 2021 01:23
Encyption/Decryption
<?php
const CIPHER_METHOD = 'AES-256-CBC';
const KEY = 'nHPOlI32ncspmDNGnNfOFUh1SI+yLCqW6MznKltCDPI=';
function encrypt($data)
{
// Get key
$key = KEY;
@helloworldlab
helloworldlab / log_viewer.md
Created October 18, 2021 02:09
Log Viewer

Pada Controller

public function senaraiRalat()
{
    $senaraiNamaFail = [];

    $files = File::files(storage_path('logs'));

    $senaraiNamaFail = array_reverse(
@helloworldlab
helloworldlab / accounting.sql
Created July 8, 2021 06:32 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@helloworldlab
helloworldlab / pdo.md
Last active January 1, 2025 08:38
PHP Database Object (PDO)

PHP Data Objects

Connect to the database

Make a connection to the database using PDO.

<?php

$host       = 'localhost';
@helloworldlab
helloworldlab / gpg.md
Last active June 28, 2021 01:06
PHP dan GPG

Pengenalan

Terdapat 2 pihak iaitu pihak A dan pihak B. Pihak A ingin menghantar encrypted data pada pihak B dan pada masa yang sama pihak B juga ingin menghantar encrypted data pada pihak A. Bagi menyelesaikan masalah ini kita boleh menggunakan asymmetric cryptography seperti library GnuPG (GPG).

Di dalam asymmetric cryptography, pihak A dan pihak B perlu mempunyai sepasang kekunci yang dipanggil sebagai Public Key dan Private Key. Public Key dan Private Key ini mempunyai tujuan masing-masing:

  1. Public Key digunakan untuk encrypt data. Jadi, Public Key boleh diberikan kepada siapa-siapa yang diinginkan.
  2. Private Key digunakan untuk decrypt data. Jadi, Private Key perlu disimpan dengan selamat dan tidak boleh diberikan kepada sesiapa.

Untuk pengetahuan anda, Private Key dan Secret Key adalah sama.