Skip to content

Instantly share code, notes, and snippets.

@juampi92
juampi92 / .jshintrc
Last active August 29, 2015 14:06 — forked from haschek/.jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
<?php
namespace App\Rules;
use Illuminate\Support\Facades\Validator;
use Illuminate\Contracts\Validation\Rule;
class BaseRule
{
protected $validator = null;
@juampi92
juampi92 / createSpotifySymLink.bat
Last active March 9, 2018 19:13
Store Spotify downloads in a custom folder using Symbolic Links (Win)
import joi from 'joi'
import validate from 'express-validation'
import middleware from 'middleware'
import AuthService from 'auth.service'
/**
* Controller's generic middleware
*/
export const middleware = [middleware.authenticate('token')]
@juampi92
juampi92 / Str.js
Created July 6, 2021 08:48 — forked from drozdzynski/Str.js
Laravel 5 slug function port to JavaScript
export default class Str {
static slug(value, sep) {
var separator = sep || '-';
value = Str.ascii(value);
var flip = separator == '-' ? '_' : '-';
value = value.replace(new RegExp(Str.pregQuote(flip), 'g'), separator);
@juampi92
juampi92 / Database.php
Created February 1, 2022 18:39
Helper Database::log() to dump query logs. Useful for debugging artisan commands or migrations.
<?php
namespace App\Support;
use Closure;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class Database
{
@juampi92
juampi92 / tests\Support\PrivateAccess.php
Created February 5, 2022 20:54
Testing private methods properties
<?php
namespace Tests\Support;
use ReflectionClass;
use ReflectionException;
use ReflectionObject;
class PrivateAccess
{
<?php
namespace App\Support;
use Generator;
class ChunkCsvReader
{
protected array|false $header;
@juampi92
juampi92 / KeyedSession.php
Created December 4, 2022 13:46
KeyedSession
<?php
namespace App\Support;
use Illuminate\Session\Store;
use RuntimeException;
/**
* Helper class that transforms all sessions into a specific key.
*
@juampi92
juampi92 / RequestBuilder.php
Created November 7, 2019 10:02
Build Requests with routes on Laravel for testing.
<?php
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Support\Facades\Route as Router;
class RequestBuilder
{
/**
* Will create a request with the correct fullUrl, route parameters and input parameters.