Skip to content

Instantly share code, notes, and snippets.

View lucablackwell's full-sized avatar
🌸
Did you know you have rights? The constitution says you do, and so do I!

Luca Blackwell lucablackwell

🌸
Did you know you have rights? The constitution says you do, and so do I!
View GitHub Profile
MuMu
Cave
Sbiz
OoSy
HuSo
Absl
BHaR
ThRe
Th2L
Drns
@lucablackwell
lucablackwell / mastermind-heroica.php
Created November 29, 2022 10:06
the 'mastermind' function of https://github.com/lucablackwell/heroica, loosely based on the 1972 board game for 2.
<?php
function cyan($text) {
return "\e[1;36m$text\e[0m";
}
function red($text) {
return "\e[1;31m$text\e[0m";
}
@lucablackwell
lucablackwell / docker-switch.sh
Created September 28, 2022 09:00
Mac version of docker switch
#!/bin/bash
# Swaps local docker instances
# (I recommend making an alias to call the script)
# Directory names will need changing for your needs!
function start () {
# Change to the chosen directory
cd ~/PhpstormProjects/$1
# Start the chosen containers
# Define primes
primes = ['Two', 'Three', 'Five', 'Seven', 'Eleven', 'Thirteen', 'Seventeen', 'Nineteen', 'TwentyThree', 'TwentyNine', 'ThirtyOne', 'ThirtySeven', 'FortyOne', 'FortyThree', 'FortySeven', 'FiftyThree', 'FiftyNine', 'SixtyOne', 'SixtySeven', 'SeventyOne', 'SeventyThree', 'SeventyNine', 'EightyThree', 'EightyNine', 'NinetySeven', 'OneHundredOne', 'OneHundredThree', 'OneHundredSeven', 'OneHundredNine', 'OneHundredThirteen', 'OneHundredTwentySeven', 'OneHundredThirtyOne', 'OneHundredThirtySeven', 'OneHundredThirtyNine', 'OneHundredFortyNine', 'OneHundredFiftyOne', 'OneHundredFiftySeven', 'OneHundredSixtyThree', 'OneHundredSixtySeven', 'OneHundredSeventyThree', 'OneHundredSeventyNine', 'OneHundredEightyOne', 'OneHundredNinetyOne', 'OneHundredNinetyThree', 'OneHundredNinetySeven', 'OneHundredNinetyNine', 'TwoHundredEleven', 'TwoHundredTwentyThree', 'TwoHundredTwentySeven', 'TwoHundredTwentyNine', 'TwoHundredThirtyThree', 'TwoHundredThirtyNine', 'TwoHundredFortyOne', 'TwoHundredFiftyOne', 'TwoHundredF
<?php
function Fibonacci($number){
if ($number == 0)
return 0;
else if ($number == 1)
return 1;
else
return (Fibonacci($number-1) +
<?php
$imey = [
'blimey',
'climey',
'chimey',
'dimey',
'flimey',
'glimey',
'himey',
'jimey',
<?php
function white_bold($text) {
return "\e[1;37m$text\e[0m";
}
function black($text) {
return "\e[1;30m$text\e[0m";
}
<?php
function sanitise_num($limit, $default) {
$sanitised = false;
$input = readline('> ');
while (!$sanitised) {
# If there are letters
if (preg_match('/[a-z]/', $input)) {
echo "No letters.\n";
$input = readline('> ');
<?php
# Colours
function cyan($text) {
return "\e[0;36m$text\e[0m";
}
function cyan_bold($text) {
return "\e[1;36m$text\e[0m";
}