Skip to content

Instantly share code, notes, and snippets.

View jhm-ciberman's full-sized avatar

Javier "Ciberman" Mora jhm-ciberman

View GitHub Profile
@jhm-ciberman
jhm-ciberman / CliffsNoiseValueGenerator.cs
Created August 7, 2024 22:42
Procedural Terrain generation + Cliffs
using System;
using System.Numerics;
using LifeSim.Support.Numerics;
namespace LifeSim.Procedural.Terrain;
public class CliffsNoiseValueGenerator : IValueGenerator
{
public class Settings
{
@jhm-ciberman
jhm-ciberman / ShadowMapTexture.cs
Created January 13, 2022 20:01
ShadowMapTexture.cs
using System;
using Veldrid;
namespace LifeSim.Engine.Rendering;
public class ShadowMapTexture : ITexture, IDisposable
{
public uint Width { get; private set; }
public uint Height { get; private set; }
@jhm-ciberman
jhm-ciberman / Vector2Int.cs
Last active December 28, 2021 22:32
Vector2Int.cs
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
namespace LifeSim
{
public struct Vector2Int : IEquatable<Vector2Int>
{
public int X;
public int Y;
@jhm-ciberman
jhm-ciberman / Demo.Lang.es.resx
Last active August 22, 2021 03:49
Lang.es.xml HandyControl Spanish
<?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 July 12, 2021 14:04
Laravel deploy script
# 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
@jhm-ciberman
jhm-ciberman / WeightedRandom.cs
Created July 2, 2020 12:20
Weighted Random C#
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
Last active February 15, 2024 02:37
Simple Automatic Test for Laravel Nova Resources (Updated for Nova 4)
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Nova;
class NovaResourcesTest extends TestCase
{
@jhm-ciberman
jhm-ciberman / LaravelValidationError.ts
Created July 25, 2018 09:02
LaravelValidationError.ts
/**
This is a typical Laravel API JSON validation error.
{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
],