Skip to content

Instantly share code, notes, and snippets.

@zaus
zaus / Test-Collection-Contains.linq.cs
Last active June 30, 2017 16:22
Comparing Collection.Contains for various sets of data
void Main()
{
// https://stackoverflow.com/questions/150750/hashset-vs-list-performance/13089134?noredirect=1#comment76605526_13089134
test(10, 5, 10, true);
test(20);
test(50);
test(100);
test(1000);
@zaus
zaus / enviro-switch.php
Created December 11, 2015 21:06
wp-config DEBUG
switch($_SERVER['HTTP_HOST']) {
case 'wp.sandbox:81':
define('DB_NAME', 'YOURDB');/** The name of the database for WordPress */
define('DB_USER', 'YOURUSER');/** MySQL database username */
define('DB_PASSWORD', 'YOURPASS');/** MySQL database password */
define('DB_HOST', 'localhost');/** MySQL hostname */ // may need to use actual computer ip in some cases
break;
default:
define('DB_NAME', 'YOURDB');/** The name of the database for WordPress */
define('DB_USER', 'YOURUSER');/** MySQL database username */
@zaus
zaus / gist:71a7a89bc3bec0d8ea2faaa287c20c82
Last active September 22, 2016 16:26 — forked from marksteve/gist:877210
Monokai Notepad2 Color Scheme /mod
[Default Text]
FileNameExtensions=txt; text; wtx; log; asc; doc
Default Style=font:DejaVu Sans Mono; size:10; fore:#F8F8F2; back:#000000
Margins and Line Numbers=size:-2; fore:#BCBCBC; back:#3B3A32
Matching Braces=size:+1; bold; fore:#000000; back:#FD971F
Matching Braces Error=size:+1; bold; fore:#F8F8F0; back:#F92672
Control Characters (Font)=size:-1
Indentation Guide (Color)=fore:#A0A0A0
Selected Text (Colors)=fore:#F8F8F2; back:#49483E; eolfilled
Whitespace (Colors, Size 0-5)=fore:#AA2B00
@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...)
@zaus
zaus / debug-me.php
Last active February 12, 2016 22:19
Simple WP debug helper "plugin"
<?php
/*
Plugin Name: Dev Debug Me
Plugin URI: https://codex.wordpress.org/Debugging_in_WordPress
Description: Just some developer includes for debugging. Not actually a plugin; activate to test log writing.
Author: zaus
Version: 0.1
Author URI: https://gist.github.com/zaus/35c1deb8ead5baa6fc40
*/
void Main()
{
var headers = new System.Net.WebHeaderCollection();
headers.Add("xxx", "yyy");
headers.Add("zzz", "f&&ff");
headers.Add("xxx", "ttt");
headers.Add("yyy", "33,3");
headers.Dump("raw");
headers.ToString().Dump("string'd");
@zaus
zaus / compObj.js
Last active January 18, 2016 16:36
Simple javascript comparison of two objects with console logging/warning when different
/**
* Compare versions of objects and warn of differences
* @param {object} v1 variant 1
* @param {object} v2 variant 2
* @param {bool} stringify optionally (if provided and `true`) stringify the variant parameters when dumping
* @param {string} root [internal use] nested key placeholder
* @example <caption>Example comparing two things:</caption>
* // should result in warnings for 'foo' and 'somebool'
* compObj({foo: "bar", id: 123, somebool: true}, {bar: "foo", id: 123, somebool: 'true'});
* @returns {void} nothing -- see console logging
@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.