Skip to content

Instantly share code, notes, and snippets.

View joparara's full-sized avatar
👋
hello world!

Joe Palala joparara

👋
hello world!
View GitHub Profile
@joparara
joparara / Response.php
Created November 17, 2023 23:35 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@joparara
joparara / get_transactions_remove_nonpublic_fields.php
Created November 7, 2023 13:55
how to remove unnecessary fields
<?php
$transactions = [
["id" => 1, "name" => "John Smith", "x" => "y"],
["id" => 2, "name" => "Joe Adam", "z" => "a"],
];
$fields = ["id", "name"];
$callback = function ($transaction) use ($fields) {
$keys = array_keys($transaction);
foreach ($keys as $key) {
@joparara
joparara / implem.php
Created October 23, 2023 23:47
memoize
<?
$memoizedAdd = memoize(
function ($num) {
return $num + 10;
}
);