Skip to content

Instantly share code, notes, and snippets.

View ajmcagadas's full-sized avatar

Tux ajmcagadas

  • 23:18 (UTC +08:00)
View GitHub Profile
Dear Amika, I still remember the day we first learned that you were coming into this world. I saw the fear and excitement in your father’s eyes when he shared the news with us, and as his friend, I could feel how much that moment meant to him. Looking back now, it is hard to believe that 18 years have already passed and it feels as though it was only yesterday. From that little girl we were waiting to meet, you have grown into the young woman you are today, and I am grateful that God allowed us to witness a part of your journey. As you begin this new chapter of your life, my prayer is that you will always keep God at the center of your heart, trust His plans even when the path is uncertain, and remember that He has a purpose for your life. May He guide your decisions, protect you wherever you go, give you courage when life becomes difficult, and bless you with a heart that remains kind, faithful, and grounded in Him. Always remember that you are deeply loved, and that the people who welcomed you into this wor
August 16,2025
SIGNATORIES
as of Aug. 27, 2025, 9:00 am
Mayor Benjie Magalong - Baguio City
Mayor Vico Sotto - Pasig City
Mayor Joy Belmonte - Quezon City
Mayor Sitti Hataman - Isabela City, Basilan
Vice Mayor Rommel Arnado - Founding M4GG convenor
@ajmcagadas
ajmcagadas / laravel-query-too-many-placeholder.php
Created March 6, 2023 01:48 — forked from sentiasa/laravel-query-too-many-placeholder.php
Laravel - Query +100k placeholders in Laravel using `whereIn()`
<?php
$transactionIds = Transaction::pluck('id'); // +100k transaction ids
$maxAtOneTime = 5000;
$total = count($transactionIds);
$pages = ceil($total / $maxAtOneTime);
$transactions = collect();
root@sydney:/mnt/vol2# rclone sync spaces-sgp1:mybucket1 /mnt/vol2 --checkers 256 --transfers 256 --progress --fast-list --size-only
2023-02-27 07:18:50 ERROR : 52231/: Failed to copy: failed to open source object: NoSuchKey:
status code: 404, request id: tx00000000000001d4ec082-0063fc595a-285cf3d6-sgp1b, host id:
2023-02-27 07:18:54 ERROR : Local file system at /mnt/vol2: not deleting files as there were IO errors
2023-02-27 07:18:54 ERROR : Local file system at /mnt/vol2: not deleting directories as there were IO errors
2023-02-27 07:18:54 ERROR : Attempt 1/3 failed with 3 errors and: failed to open source object: NoSuchKey:
status code: 404, request id: tx00000000000001d4ec082-0063fc595a-285cf3d6-sgp1b, host id:
Transferred: 2.276M / 2.276 MBytes, 100%, 3.198 MBytes/s, ETA 0s
2023-02-27 07:20:04 ERROR : 52231/: Failed to copy: failed to open source object: NoSuchKey:
status code: 404, request id: tx00000000000001d4e5352-0063fc59a4-28667c7c-sgp1b, host id:
@ajmcagadas
ajmcagadas / s3_set_object_public.sh
Last active February 16, 2023 01:24
Make S3 object public and private via s3cmd command line
s3cmd setacl s3://bucket/path/to/file --acl-public
s3cmd info s3://bucket/path/to/file
s3cmd setacl s3://bucket/path/to/file --acl-private
# S3CMD SET ALL FILES IN FOLDER TO PRIVATE
s3cmd setacl s3://bucket/path/to/file --acl-private --recursive
@ajmcagadas
ajmcagadas / keypress.js
Created June 3, 2021 06:46
Reactjs prevent characters on keypress
use { useState } from 'react';
const Test = () => {
const [tipAmount, setTipAmount] = useState('');
const handleKeypress = (e) => {
if(!((e.keyCode > 95 && e.keyCode < 106)
|| (e.keyCode > 47 && e.keyCode < 58)
|| e.keyCode == 8)) {
e.preventDefault(); // Let's stop this event.
@ajmcagadas
ajmcagadas / 422Error.php
Created May 14, 2021 19:19
Laravel Throw custom 422 error message
<?php
use Illuminate\Validation\ValidationException;
throw ValidationException::withMessages(['field_name' => 'This value is incorrect']);
@ajmcagadas
ajmcagadas / countries.json
Created April 16, 2021 02:00
Alpha-2 ISO3166 countries
[
{
"label": "Afghanistan",
"value": "AF"
},
{
"label": "Åland Islands",
"value": "AX"
},
{
@ajmcagadas
ajmcagadas / SomeController.php
Created April 11, 2021 14:17
Dompdf API response
<?php
public function pdf($id)
{
//...
$pdf = PDF::loadView('pdf.payroll');
return response()->json([
'pdf' => base64_encode($pdf->output())
]);
@ajmcagadas
ajmcagadas / formatBytes.js
Created March 23, 2021 02:28 — forked from zentala/formatBytes.js
Convert size in bytes to human readable format (JavaScript)
function formatBytes(bytes,decimals) {
if(bytes == 0) return '0 Bytes';
var k = 1024,
dm = decimals || 2,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
// Usage: