Skip to content

Instantly share code, notes, and snippets.

View carbontwelve's full-sized avatar
🎯
Focusing

Simon Dann carbontwelve

🎯
Focusing
View GitHub Profile
@carbontwelve
carbontwelve / README.md
Created December 14, 2022 13:01 — forked from dsample/README.md
ASCII art diagrams

ASCI art characters for creating diagrams

Characters:

Single line

  • ASCII code 191 = ┐ ( Box drawing character single line upper right corner )
  • ASCII code 192 = └ ( Box drawing character single line lower left corner )
  • ASCII code 193 = ┴ ( Box drawing character single line horizontal and up )
  • ASCII code 194 = ┬ ( Box drawing character single line horizontal down )
<?php
/*
* PHP Space Mines Simulation
* Based upon Space Mines from Usborne Computer Space Games
* @see https://photogabble.co.uk/noteworthy/php-space-mines-introduction/
*/
function lerp($a, $b, $t): float
{
@carbontwelve
carbontwelve / alice_in_wonderland.txt
Created February 1, 2022 14:11
Large Text Sources
Alice's Adventures in Wonderland
ALICE'S ADVENTURES IN WONDERLAND
Lewis Carroll
THE MILLENNIUM FULCRUM EDITION 3.0
@carbontwelve
carbontwelve / perlin.php
Created January 24, 2022 21:24 — forked from dazld/perlin.php
PHP Perlin Noise Class
<?php
//This is a port of Ken Perlin's "Improved Noise"
// http://mrl.nyu.edu/~perlin/noise/
// Originally from http://therandomuniverse.blogspot.com/2007/01/perlin-noise-your-new-best-friend.html
// but the site appears to be down, so here is a mirror of it
class Perlin {
var $p, $permutation, $seed;
@carbontwelve
carbontwelve / fill_screen.c
Last active May 10, 2021 21:34
DOS C Programming
#include <conio.h>
/*
This program fills the screen with an extended ASCII character 129 (octal 201). As
you press any key the foreground colour is incremented through all 16 foreground
colours. This was written to test an issue I was having with the Watcom graph.h
library to see if the issue was with my environment (DOS Box) or my program. The
problem was extended ASCII characters always showing as a colour one less than the
background colour.
@carbontwelve
carbontwelve / AblyBatchBroadcaster.php
Created March 24, 2021 13:01
Example of using Ably's Batch mode with Laravel
<?php
namespace App\Broadcasting;
use Illuminate\Broadcasting\Broadcasters\AblyBroadcaster;
class AblyBatchBroadcaster extends AblyBroadcaster
{
private $batch = [];
@carbontwelve
carbontwelve / atatus.js
Created July 9, 2020 13:14
Atatus plugin for nuxt.js
import * as atatus from 'atatus-spa';
import Vue from 'vue';
/*
* classifyRE, classify and formatComponentName are taken from
* node_modules/vue-template-compiler/build.js due to them
* seemingly being made private methods in Vue2.
*/
const classifyRE = /(?:^|[-_])(\w)/g;
const classify = function(str) {
body{
background: #fff3e1;
color: #5a5a5a;
font-size: 20px;
}
body h1 a, body header h2 a {
color: #5a5a5a;
}
@carbontwelve
carbontwelve / wordsmith.css
Last active December 17, 2019 18:05
increment.com inspired css for writefreely
body {
background-color: #efefef;
}
/* Blog header on index and post pages */
#blog-title a {
color: #fff;
background-color: #7a629d;
padding: 0.5em;
display: inline-block;
@carbontwelve
carbontwelve / RouteListCommand.php
Created November 9, 2018 12:25
Command that overloads the laravel route:list and adds tenant aware capabilities.
<?php
namespace App\Console\Commands;
use Illuminate\Foundation\Console\RouteListCommand as BaseRouteListCommand;
use Illuminate\Routing\RouteCollection;
use Illuminate\Routing\UrlGenerator;
use Symfony\Component\Console\Input\InputOption;
class RouteListCommand extends BaseRouteListCommand