Skip to content

Instantly share code, notes, and snippets.

View MickeyKay's full-sized avatar
🐶
Making things

Mickey Kay MickeyKay

🐶
Making things
View GitHub Profile
const util = require('util')
const mapString = `
#.########################################################################################################################
#<^vvv<v^v>^vvv.v<vv<>^^<^><.vvv^>v<^<<<<^>^vv^>^<^>>v>v^v^>^v>vv>^.^..v<^<^^^>>>><<>v<^^^v<>>><>.vv^vv>v.vv<<^<.v...^v.<#
#<^^><><^^^<^>>v^^>v<^vvvv><vv<v.<vv^v<>v^.v^>v^v<>^<>^<vv.v^.^<<<^^^..<.><<v<vv^<v^^>>.><v<vv.>v>><<v.v^<^<v^^^^vv^v>^v>#
#<^.>>v<<vv^^<<<<<.<v<>^>v^v<v<<<^<v^<<vvvv>v<^v<^v<>v.<>v^^^.^vv.<vv>v<^^v^>>.><^.><<<>v^>><^.<><>v^vv>>^v>>.><vvv^<<>v<#
#>v^v<>^<.^.^>><>>..<vv<>^>>vv<.<.<^v<^<>>><<^v.v^<v<vv><v.<v.>v^v^<.v>^v^<^.v>.v.>^<v^>vv><<v.>^>v><<^vv<v^>v>v>.>v>>><.#
#><<<^<v.><>>^>v<^><^<^v.^v<vv<<^^vvv><^^>>>>v^.^^v^<v^^.vv^v^<.v<v^^v<^..>>v<^v^.v^^^^.>v^<vv^<<>><<>vv><^<<^^><..vv.v^.#
#<^>^.^v.><^>.v<v<>^<^<<<<<^^><vv.>^v><^<.>>.><^<v>>>^^^vvv<>v^^^<.^v^<^v<v>^.^.<>v^.v>v<v^<^^vv.^<><>v^>>.^>>><>><>v..^<#
@MickeyKay
MickeyKay / functions.js
Created April 1, 2018 03:58
Nested for loop example (better)
var list = ['SoMe', 'hUgE', 'aRrAy', '...'];
// Helper functions
function reverseText(text) {
// A
// big
// chunk
// of
// code
@MickeyKay
MickeyKay / functions.js
Last active April 1, 2018 03:59
Nested for loop example (not so great)
var list = ['some', 'huge', 'array', '...'];
function reverseAndCapitalizeOrLowercase(list) {
list.forEach(function(text) {
// A
// big
// chunk
// of
// code
@MickeyKay
MickeyKay / custom-ssn.php
Created January 8, 2015 19:41
Custom Simple Section Navigation for posts that don't have a parent
<?php
add_shortcode( 'ssn', 'esw_custom_ssn' );
/**
* Emulate Simple Section Nav for a specific parent post/page.
*
* Example: [ssn ancestor="ancestor_id" parent="parent_id" depth="depth"]
*
* @since 1.0.0
*
@MickeyKay
MickeyKay / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@MickeyKay
MickeyKay / wp-show-all-parents.php
Last active August 29, 2015 14:06
[WordPress] Include private, draft, and pending posts in parent dropdowns (single post, bulk edit, and quick edit views).
add_filter( 'page_attributes_dropdown_pages_args', 'my_slug_show_all_parents' );
add_filter( 'quick_edit_dropdown_pages_args', 'my_slug_show_all_parents' );
/**
* Show all parents, regardless of post status.
*
* @since 1.0.0
*
* @param array $args Original get_pages() $args.
*
* @return array $args Args set to also include posts with pending, draft, and private status.
@MickeyKay
MickeyKay / equal-height-columns.js
Last active July 26, 2018 11:13
Equal Height Columns jQuery
/**
* Equal Heights Plugin
*
* Equalize the heights of elements. Great for columns or any elements
* that need to be the same size (floats, etc).
*
* Based on Rob Glazebrook's (cssnewbie.com) script
*
* Additions
* - ability to include a break point (the minimum viewport width at which the script does anything)
@MickeyKay
MickeyKay / wp-override-title.php
Last active August 29, 2015 14:04
[WordPress] Override the default post title with a custom field.
// Only override the title on the front-end.
if ( ! is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
add_filter( 'the_title', 'PREFIX_override_post_title', 10, 2 );
}
/**
* Override the_title() with a custom field if it is specified.
*
* @param string $title Original post title.
*
* @return string $title Update post title.
@MickeyKay
MickeyKay / dividize.js
Created June 30, 2014 21:30
dividize.js
/**
* Wrap elements in a set number of container elements with specific classes.
*
* Example Usage: wrap every 3 <li> elements within a <div class="col"></div>
* jQuery('li').dividize(3, 'div', 'col');
*
* @param int columnNumber Number of columns.
* @param string wrapperElement The wrapper container (e.g. div, span).
* @param string className Class to add to the wrapper containers.
*