Skip to content

Instantly share code, notes, and snippets.

Avatar

Javier "Ciberman" Mora jhm-ciberman

View GitHub Profile
@jhm-ciberman
jhm-ciberman / Demo.Lang.es.resx
Last active Aug 22, 2021
Lang.es.xml HandyControl Spanish
View Demo.Lang.es.resx
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
@jhm-ciberman
jhm-ciberman / deploy.sh
Created Jul 12, 2021
Laravel deploy script
View deploy.sh
# Change to the project directory
cd /var/www/your-laravel-app
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
git reset --hard
git clean -df
git pull origin master
View WeightedRandom.cs
using System.Collections.Generic;
// Author: Javier "Ciberman" Mora
// License: MIT
// Enjoy!
public class WeightedRandom<T>
{
private struct Value
{
public T value;
@jhm-ciberman
jhm-ciberman / NovaResourcesTest.php
Created Apr 28, 2019
Simple Automatic Test for Laravel Nova Resources
View NovaResourcesTest.php
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Request;
use Laravel\Nova\Nova;
use Laravel\Nova\Resource;
View LaravelValidationError.ts
/**
This is a typical Laravel API JSON validation error.
{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
],