Skip to content

Instantly share code, notes, and snippets.

View ajcastro's full-sized avatar

Arjon Jason Castro ajcastro

View GitHub Profile
@ajcastro
ajcastro / country_dial_info.json
Created March 17, 2021 16:42 — forked from DmytroLisitsyn/country_dial_info.json
A JSON dataset of entities containing country name, code, dial (phone) code and flag emoji icon.
[{"name":"Afghanistan","flag":"🇦🇫","code":"AF","dial_code":"+93"},{"name":"Åland Islands","flag":"🇦🇽","code":"AX","dial_code":"+358"},{"name":"Albania","flag":"🇦🇱","code":"AL","dial_code":"+355"},{"name":"Algeria","flag":"🇩🇿","code":"DZ","dial_code":"+213"},{"name":"American Samoa","flag":"🇦🇸","code":"AS","dial_code":"+1684"},{"name":"Andorra","flag":"🇦🇩","code":"AD","dial_code":"+376"},{"name":"Angola","flag":"🇦🇴","code":"AO","dial_code":"+244"},{"name":"Anguilla","flag":"🇦🇮","code":"AI","dial_code":"+1264"},{"name":"Antarctica","flag":"🇦🇶","code":"AQ","dial_code":"+672"},{"name":"Antigua and Barbuda","flag":"🇦🇬","code":"AG","dial_code":"+1268"},{"name":"Argentina","flag":"🇦🇷","code":"AR","dial_code":"+54"},{"name":"Armenia","flag":"🇦🇲","code":"AM","dial_code":"+374"},{"name":"Aruba","flag":"🇦🇼","code":"AW","dial_code":"+297"},{"name":"Australia","flag":"🇦🇺","code":"AU","dial_code":"+61"},{"name":"Austria","flag":"🇦🇹","code":"AT","dial_code":"+43"},{"name":"Azerbaijan","flag":"🇦🇿","code":"AZ","dial_code":"+9
My notes for upgrading laragon to work with latest apache and php8.1
Update to laragon 5:
- Stop all running services in laragon
- Make sure laragon itself is properly closed
- Download the latest laragon.exe and overwrite your original laragon.exe
https://github.com/leokhoa/laragon/releases/download/5.0.0/laragon.exe
Update to latest apache
- Download the latest apache 2.4 VS16 for windows (Apache 2.4.x OpenSSL 1.1.1 VS16):
composer create-project --prefer-dist laravel/laravel <project_name>
composer require garygreen/pretty-routes predis/predis laravel/telescope tymon/jwt-auth mxl/laravel-job laravel/helpers
composer require --dev styde/enlighten
@ajcastro
ajcastro / varexport.php
Created September 5, 2019 06:53
PHP var_export() with short array syntax (square brackets) indented 4 spaces
<?php
function varexport($expression, $return=FALSE) {
$export = var_export($expression, TRUE);
$export = preg_replace("/^([ ]*)(.*)/m", '$1$1$2', $export);
$array = preg_split("/\r\n|\n|\r/", $export);
$array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array);
$export = join(PHP_EOL, array_filter(["["] + $array));
if ((bool)$return) return $export; else echo $export;
}
@ajcastro
ajcastro / rclonesetup.txt
Created May 17, 2021 03:25
rclone-setup
https://www.youtube.com/watch?v=zlz3OtI1n9w&list=PLksJKA0gKBYyY6g7xJ85Ylx4J3LrCPGoC
@ajcastro
ajcastro / cypress_seed.js
Last active February 18, 2020 14:18
Cypress seed api
// cy.seed(...) to call a seeder from api
Cypress.Commands.add('seed', (seeder) => {
// here you will notice that we namespaced our seeders for e2e tests
cy.request('GET', Cypress.config().apiUrl + 'seed?seeder=' + 'Seeds\\E2E\\' + seeder)
})
// routes/web.php
if (app()->environment() !== 'production') {
Route::get('/seed', function ($model) {
\Artisan::call('db:seed', ['--class' => request('seeder')]);
# Instructions. Copy and paste the codes below:
cd /usr/local/src
# Download all needed archives, four(4) archives
# For PHP source
wget http://au1.php.net/get/php-5.6.21.tar.bz2/from/this/mirror -O php.tar.gz
# For curl. You can choose from any mirror site from https://curl.haxx.se/latest.cgi?curl=tar.gz&all=yes
wget https://dl.uxnr.de/mirror/curl/curl-7.48.0.tar.gz
# For libxml2
@ajcastro
ajcastro / Component.vue
Last active January 21, 2020 04:49 — forked from christian-smith/Component.vue
Quasar QTable Bottom Pagination
<q-table
:data="data"
:pagination="pagination"
@request="paginationRequest"
:columns="columns"
>
<template v-slot:top-left="props">
<TablePagination
:pagination="props.pagination"
:filter="table.filter"
@ajcastro
ajcastro / BaseCrudController.php
Created August 17, 2019 12:43
BaseCrudController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Services\Paginator\Paginator;
use Illuminate\Database\QueryException;
use Illuminate\Validation\ValidationException;
abstract class BaseCrudController extends Controller
@ajcastro
ajcastro / Car.php
Created August 12, 2019 02:55 — forked from jgrossi/Car.php
How to use Eloquent (from Laravel) inside Wordpress
<?php // File location: /wp-content/themes/my-theme/src/Models/
namespace App\Models;
use Illuminate\Database\Eloquent\Model as Eloquent;
class Car extends Eloquent
{
protected $table = 'cars';
protected $primaryId = 'id';