Skip to content

Instantly share code, notes, and snippets.

View crispy-computing-machine's full-sized avatar

Crispy Computing Machine. crispy-computing-machine

View GitHub Profile
@crispy-computing-machine
crispy-computing-machine / create-table.js
Created December 13, 2017 12:30
Create Table With Javascript/jQuery
var testCount = 101;
// Main elements
var $table = $("<table>", {
'border':'1'
});
var $thead = $("<thead>");
var $tbody = $("<tbody>");
// Add some headers
@crispy-computing-machine
crispy-computing-machine / gpw.php
Created August 14, 2018 10:11
GPW - Generate pronounceable passwords - Ported to PHP
<?php
/* GPW - Generate pronounceable passwords
This program uses statistics on the frequency of three-letter sequences
in English to generate passwords. The statistics are
generated from your dictionary by the program load_trigram.
See www.multicians.org/thvv/gpw.html for history and info.
Tom Van Vleck
#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>
#define VAR_DUMP(var) _var_dump(#var, var)
void _var_dump(const char *var_name, ...);
int main() {
int i = 42;
@crispy-computing-machine
crispy-computing-machine / self-modifying.php
Created April 17, 2023 11:04
PHP self-modifying code
<?php
// Define the code to modify
$code = <<<EOT
<?php
echo "Hello, world!";
?>
EOT;
// Modify the code
$code = str_replace('world', 'PHP', $code);
<?php
function displayProgressBar(int $current, int $total): void {
$width = 50; // The width of the progress bar
$percent = (int)(($current / $total) * 100);
$progress = (int)(($current / $total) * $width);
// Build the progress bar string
$progressBar = '[';
for ($i = 0; $i < $width; $i++) {
<?php
class LatticeRandomWalk {
private int $width;
private int $height;
private int $steps;
private array $color;
private int $stepLength;
public function __construct(int $width, int $height, int $steps, int $stepLength = 1, array $color = [0, 0, 0]) {
$this->width = $width;
@crispy-computing-machine
crispy-computing-machine / RPGMapGenerator.php
Created May 4, 2023 07:20
PerlinNoise RPG Map Generator
<?php
require 'vendor/autoload.php';
/**
* composer require martinlindhe/php-noisegenerator
*/
class RPGMapGenerator
{
private int $width;
<?php
require 'vendor/autoload.php';
/**
* composer require lunakid/anim-gif
*/
class AnimatedGifCreator
{
private string $imageFolderPath;
private int $animationDelay;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<style>
.mech {
position: relative;
height: 200px;
<!DOCTYPE html>
<html>
<head>
<style>
#myCanvas {
border: 1px solid black;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.14.2/matter.min.js"></script>
</head>