Skip to content

Instantly share code, notes, and snippets.

View skoskie's full-sized avatar

Shelton Koskie skoskie

View GitHub Profile
@skoskie
skoskie / all-shortcode-args.php
Last active March 4, 2019 02:42
In Wordpress, this function will get a list of all parameters defined in all functions that are used as shortcodes. Why anyone would ever need something like this, I have no idea.
<?php
/**
* Gets all arguments for all shortcode functions and returns them as an array.
*
* @method get_all_shortcode_args
*
* @param boolean $ignore_native Whether to ignore the native Wordpress shortcodes.
*
* @param boolean $dedupe Whether to return unique values or allow duplicates.
*
@skoskie
skoskie / todo-html.sublime-completions
Last active December 14, 2015 14:58
Sublime Text auto-completions for TODO, FIXME, CHANGED, and NOTE comments. Intended to be compatible with SublimeTODO: https://github.com/robcowie/SublimeTODO
{
"scope": "text.html",
"completions":
[
{
"trigger" : "todo",
"contents" : "<?php\n/**\n *\t\tTODO: ${1:New Todo Item}\n */\n?>"
},
{
"trigger" : "fixme",
@skoskie
skoskie / acf-metabox-hack.html
Last active January 12, 2019 19:42
This is a temporary work-around for the Advanced Custom Fields Wordpress plugin's lack of support for blank meta boxes. A feature request for this capability was made on the plugin's Github page: https://github.com/elliotcondon/acf/issues/19. #wordpress #acf
<p>Here you may add a new row for every new question and answer set you wish to display.</p>
<div class="postbox">
<h3>Tips</h3>
<div class="inside">
<ul style="list-style-type:disc; list-style-position:inside; margin-left:30px;">
<li>Hover your cursor over the <span id="highlight-left-margin" style="text-decoration:underline; font-weight:bold; cursor:pointer;">left margin</span> and click to drag our FAQ items into a different order.</li>
<li>Hover over the <span id="highlight-right-margin" style="text-decoration:underline; font-weight:bold; cursor:pointer;">right margin</span> and click on the <i>plus<i> to add a new FAQ item. Click on the <i>minus</i> to delete an tem.</li>
<li>Some fields allow you to use basic <abbr title="Hypertext Markup anguage." style="border-bottom:1px dotted;">HTML</abbr> tags, like &lt;b&gt;<b>bold</b>&lt;/b&gt; and &lt;i&gt;<i>italic</i>&lt;/i&gt;.</i>
</ul>
</div>
@skoskie
skoskie / Domain Regex
Created January 2, 2013 14:56
Very simple regex to check if a url is of a particular domain. Doesn't support subdomains except for "www".
^(http(s?):\/\/(www\.?)amazon.com)
@skoskie
skoskie / getJquery2.html
Last active January 12, 2019 19:44
The unofficial new way to call jQuery 2.0. #jquery #cdn
<!-- https://twitter.com/paul_irish/status/218395508018921472 -->
<!--[if lte IE 8]>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
window.jQuery || document.write('<script src="js/libs/jquery-1.9.0.min.js"><\/script>')
</script>
// call old jQuery plugin 1
// call old jQuery plugin 2
<![endif]-->
<!--[if (gt IE 8)|!(IE)]>
@skoskie
skoskie / css-minimizing-regex.txt
Last active September 27, 2015 02:58
CSS Minimizing Regex
(\/\*(.|\s)*?\*\/|(\n|\t|\r|\v|\f|\a){1,}|\s(?=\s)|(?<=})\s|(?<={)\s|\s(?={)|\s(?=})|(?<=;)\s|[[:blank:]](?=;)|(?<=:)[[:blank:]]|(?<=,)[[:blank:]])