Skip to content

Instantly share code, notes, and snippets.

@Otto42
Otto42 / gist:b520710eb40bf95bde12
Created October 21, 2015 18:43
-- HUMAN RESOURCE MACHINE PROGRAM -- -- 41 Sorting Floor - Basic Bubble Sort --
-- HUMAN RESOURCE MACHINE PROGRAM --
-- 41 Sorting Floor - Basic Bubble Sort --
-- Does not achieve any records, but demonstrates the principle of a bubble sort. --
-- Explanation --
-- Each element is copied to the floor until a zero is reached. --
-- CMP is set to the max elements location. --
-- CMP 2 is decremented and each element compared. If the result is not negative, the elements are swapped, using TMP as a temporary holding area. --
-- Once CMP 2 becomes negative, CMP is decreased and the loop repeated. --
@Otto42
Otto42 / simple-table.php
Created January 3, 2016 14:44
Simple tables plugin (use [table]...[/table] shortcode around CSV data in rows.
<?php
/*
Plugin Name: Simple Table
Plugin URI: http://ottopress.com/wordpress-plugins/simple-table/
Description: Add a [table] shortcode for making tables
Version: 0.1
Author: Otto
Author URI: http://ottopress.com
License: GPLv2
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
@Otto42
Otto42 / redball.svg
Created June 28, 2016 19:28
An animated red ball SVG. Move it around with WASD.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Otto42
Otto42 / decode.php
Last active October 31, 2022 04:54
Decode a file with encoded strings
<?php
// Decodes files that have a bunch of strings with things like "\x6d" and "\155" and such in them.
// Meat of the code from https://stackoverflow.com/questions/13774215/convert-hex-code-into-readable-string-in-php
// run me like so on command line:
// php decode.php < encoded.php > output.php
function decode_code($code)
{
return preg_replace_callback('@\\\(x)?([0-9a-f]{2,3})@',
function ($m) {
if ($m[1]) {
<?php
/*
Plugin Name: Testing
*/
class Demo {
function do_a_thing() {
echo '<!-- demo -->';
}
}