Skip to content

Instantly share code, notes, and snippets.

@zaus
zaus / =ChromeDevToolsSnippets.md
Last active August 6, 2016 18:14
Chrome DevTools Snippets (because it doesn't save when you clear your user data...)
/// <summary>
/// PGP round-trip encryption -- http://blogs.microsoft.co.il/kim/2009/01/23/pgp-zip-encrypted-files-with-c/#comment-611002
/// </summary>
public class PGPEncryptDecrypt
{
/**
* A simple routine that opens a key ring file and loads the first available key suitable for
* encryption.
*
* @param in
@zaus
zaus / WpPluginUpgradeBase.php
Last active October 2, 2020 17:10
Wordpress Activation/Upgrade Hook Helper
<?php
if(!class_exists('WpPluginUpgradeBase')) :
abstract class WpPluginUpgradeBase {
function __construct() {
add_action( 'admin_init', array(&$this, 'load_plugin') );
}
@zaus
zaus / F1-Main.cs
Last active August 29, 2015 14:04
Partitioning performance comparisons -- via http://stackoverflow.com/a/13745058/1037948. Essentially runs each scenario 10000 times wrapped in a timer and compares the elapsed times.
void Main()
{
test(100, 9);
test(1000, 9);
test(100, 25);
test(10000, 100);
}
// Define other methods and classes here
void test(int populationSize, int segmentSize) {
@zaus
zaus / copied-js.md
Last active August 29, 2015 14:00
Testing Syntax Highlighting Error

// Disable Context Menu document.oncontextmenu = function () { return false };

// Disable dragging of HTML elements document.ondragstart = function () { return false };

@zaus
zaus / forms-3rdparty-migrate.php
Last active August 29, 2015 13:58
Forms-3rdparty Migrate Hack -- quick "plugin" to upgrade from CF7-3rdparty to http://wordpress.org/plugins/forms-3rdparty-integration/, or migrate settings across sites.
<?php
/*
Plugin Name: Forms: 3rd-Party Migrate
Plugin URI: https://github.com/zaus/forms-3rdparty-migrate
Description: Export/Import settings for Forms-3rdparty, or migrate to/from CF7-3rdparty
Author: zaus
Version: 0.3.2
Author URI: http://drzaus.com
*/
@zaus
zaus / LinqPad.MyExtensions.cs
Last active February 20, 2021 15:42
Linqpad Extensions - `.Title()`, `.DumpFormat(tokens)`, `.Perf(task)`, `.Vs(tasks)`
/// <summary>Silly convenience initializer for creating Vs tasks with a dictionary;
/// can use <code>new Perf { { "task1", n => whatever }, {"task2", n => bar}...}.Vs()</code>
/// <para>see http://stackoverflow.com/a/14000325/1037948 </para>
/// </summary>
/// <remarks>Doesn't automatically call <see cref="Vs"/> because...</remarks>
public class Perf : Dictionary<string, Action<int>> {}
/// <summary>Silly convenience initializer for creating Vs tasks with a dictionary that can also provides some output;
/// can use <code>new Perf&lt;T&gt; { { "task1", n => whatever }, {"task2", n => bar}...}.Vs()</code>
/// <para>see http://stackoverflow.com/a/14000325/1037948 </para>
@zaus
zaus / Random-Maze-Generator.markdown
Created December 18, 2013 14:42
A Pen by Gabriel Valfridsson.

Random Maze Generator

Generating a maze with a simple algorithm

  1. Find available directions
  2. pick one at random
  3. if no available directions, backtrack to last position loop step 1 to 3 until back at start location

A Pen by Gabriel Valfridsson on CodePen.

@zaus
zaus / Platform-game-engine.markdown
Created December 12, 2013 16:27
A Pen by suffick.

Platform game engine

A simple platform game engine, the map is customisable and scriptable. Refer to the comments in the "map" variable for instructions.

I plan to expand the engine in the future, the ability to use images for tiles and the player is one thing that I have in mind. Any suggestions are welcome.

A Pen by suffick on CodePen.

License.