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 / curl_example.php
Created March 27, 2014 13:54
PHP Curl to check if url is alive
<?php
function check_alive($url, $timeout = 10, $successOn = array(200, 301)) {
$ch = curl_init($url);
// Set request options
curl_setopt_array($ch, array(
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_NOBODY => true,
CURLOPT_TIMEOUT => $timeout,
@carbontwelve
carbontwelve / usefull_commands.sh
Last active June 24, 2021 06:10
Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
# Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
php -dxdebug.remote_autostart artisan
#Running phpcs for 5.3:
phpcs -pv --standards= --runtime-set testVersion 5.3 --ignore=*/public/*,*.js,*.css,*/tests/*,*/views/training/* .
@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) {
@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;