Skip to content

Instantly share code, notes, and snippets.

Arjon Jason Castro ajcastro

View GitHub Profile
View Laravel Standard Install.txt
composer create-project --prefer-dist laravel/laravel <project_name>
composer require garygreen/pretty-routes predis/predis laravel/telescope ajcastro/fk-adder tymon/jwt-auth
@ajcastro
ajcastro / cypress_seed.js
Last active Feb 18, 2020
Cypress seed api
View cypress_seed.js
// 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')]);
@ajcastro
ajcastro / Component.vue
Last active Jan 21, 2020 — forked from christian-smith/Component.vue
Quasar QTable Bottom Pagination
View Component.vue
<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 / varexport.php
Created Sep 5, 2019
PHP var_export() with short array syntax (square brackets) indented 4 spaces
View varexport.php
<?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;
}
View 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 Aug 12, 2019 — forked from jgrossi/Car.php
How to use Eloquent (from Laravel) inside Wordpress
View Car.php
<?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';
View axios.cancellable.js
import axios from 'axios'
export default class Cancellable {
constructor(cancelMessage) {
this.cancelMessage = cancelMessage
this.cancelToken = null
}
axios(fn) {
if (this.cancelToken) {
View mysql_gzip.txt
gzip -dc ~/Projects/ | mysql -u 'homestead' -p simmfins_laravel
gzip -dc ~/Projects/ | mysql <db>
View vbox_help.txt
https://askubuntu.com/questions/900118/vboxdrv-sh-failed-modprobe-vboxdrv-failed-please-use-dmesg-to-find-out-why
https://stegard.net/2016/10/virtualbox-secure-boot-ubuntu-fail/
https://askubuntu.com/a/802682
View gnucash_solution_for_keys.txt
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1306500
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1316186
Google: gnucash backspace doesn't work
You can’t perform that action at this time.