Skip to content

Instantly share code, notes, and snippets.

@Michael-Brooks
Michael-Brooks / passwordValidation.php
Last active July 7, 2024 03:44
Laravel Password validation Regex (Contain at least one uppercase/lowercase letters and one number)
<?php
/*
* Place this with the rest of your rules.
* Doesn't need to be in an array as there are no pipes.
* Password is required with a minimum of 6 characters
* Should have at least 1 lowercase AND 1 uppercase AND 1 number
*/
$rules = [
'password' => 'required|min:6|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$/'
];
@davidfowl
davidfowl / dotnetlayout.md
Last active July 12, 2024 04:04
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
<?php
class ReadOnlyFileStreamWrapper{
const SCHEME_RAW = "pmmpreadonly";
const SCHEME = self::SCHEME_RAW . "://";
private $realPointer;
public function stream_open($path, $mode){
assert(substr($path, 0, strlen(self::SCHEME)) === self::SCHEME);
@sergeyklay
sergeyklay / CMakeLists.txt
Last active April 6, 2024 18:52
CMakeLists.txt for PHP-extension. This CMake file is just for syntax highlighting in CLion.
cmake_minimum_required(VERSION 3.5)
project(extname
VERSION 1.0.0
LANGUAGES C)
message(STATUS "Begin cmaking of PHP extension ...")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
@calebporzio
calebporzio / PreviewOfUpcomingPackage.php
Last active April 16, 2024 06:26
A model trait that allows child models to use parent table names and relationship keys.
<?php
namespace App\Abilities;
use Illuminate\Support\Str;
use ReflectionClass;
/**
* Note: This is a preview of an upcoming package from Tighten.
**/
@AJMaxwell
AJMaxwell / cache-warmer.sh
Last active May 26, 2024 21:36
A quick bash script I wrote to prime the cache of all my websites. This script grabs the sitemap of the site you wish to warm, then grep the urls to wget each one to cache it on the server.
#!/bin/bash
#####################################################################################################
# Cache Warmer
#
# Useage: cache-warmer.sh ...args
#
# This script grabs the sitemap of the site you wish to warm, then grep the urls to wget each one
# to cache it on the server. I'm sure there are better ways to do this, but this was a simple enough
# method for my needs. I didn't want to have to type in the urls each time I warmed their cache, so
# I just made simple functions with short names to feed those urls into the cache warming function.
@dktapps
dktapps / run.php
Last active February 15, 2023 04:52
A basic UDP proxy used to bypass client-side Xbox Live authentication in MCPE 1.2.
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
@JackNoordhuis
JackNoordhuis / extract.php
Created February 26, 2018 03:17
PHP script to convert a phar archive to a zip
<?php
$opts = getopt("", ["file:"]);
if(!isset($opts["file"])) {
echo "Please specify a path with --path" . PHP_EOL;
exit(0);
}
$filename = rtrim($opts["file"], ".phar");
@Tomcc
Tomcc / blockstate_protocol.md
Last active April 9, 2024 08:42
Block Changes in Beta 1.2.13

Block Storage & Network Protocol Changes

Paletted chunks & removing BlockIDs brings a few big changes to how blocks are represented. In Bedrock, Blocks used to be represented by their 8 bit ID and 4 bit data; this means that we can only represent 256 blocks and 16 variants for each block. As it happens we ran out of IDs in Update Aquatic, so we had to do something about it :)

After this change, we can represent infinite types of Blocks and infinite BlockStates, just like in Java. BlockStates are what is sent over the network as they are roughly equivalent to the old ID+data information, eg. they're all the information attached to a block.

BlockStates are serialized in two ways:

PersistentID: a PersistentID is a NBT tag containing the BlockState name and its variant number; for example

@andrewwiik
andrewwiik / free.md
Last active December 25, 2021 12:23
Packix Developer Setup

Packix Free Developer Setup

If you plan on submitting paid tweaks please follow the paid guide down above

STEP 1 - Become Packix Developer

The Packix Maintainers will need your Packix Account ID, this can be found on your Packix account page under your name. You need to DM your account ID to @iospackixrepo. Once they let you know that they have added you as a developer you can continue to the next step.

STEP 6 - Finish Becoming Packix Developer

After we add you as a developer you will need to follow the banner on the top of Packix Developer Panel and fill out your Developer Information, this is what your customers will see. This is the link to the Developer Info to fill our your Developer Info: https://developer.packix.com/#/developer/info