Skip to content

Instantly share code, notes, and snippets.

View CrowderSoup's full-sized avatar
🦄
[object Object]

Aaron Crowder CrowderSoup

🦄
[object Object]
View GitHub Profile
@CrowderSoup
CrowderSoup / print_path.ps1
Created January 24, 2014 14:41
Powershell snippet to print out the Path, with each value on a new line.
$env:Path.split(";")
@CrowderSoup
CrowderSoup / validationExample.js
Created September 12, 2013 15:36
Quick example of how to do validation with Knockout Validation.
self.validation = ko.validatedObservable({
'noteBody': self.noteBody
});
if (!self.validation.isValid()) {
self.validation.errors.showAllMessages();
return;
}
@CrowderSoup
CrowderSoup / markRead.js
Created June 17, 2013 22:02
Mark All items as "read" in WordPress.com comment archive.
jQuery('.wpn-note-summary').each(function(){jQuery(this).trigger('click');});
@CrowderSoup
CrowderSoup / SuperDump.php
Created May 24, 2013 18:15
A better better var_dump for arrays OR objects (or objects within arrays... or arrays within objects).
<?php
class util
{
/**
* SuperDump()
*
* Better var_dump for Arrays and Objects. Prints an array out in a
* formatted manner.
*
@CrowderSoup
CrowderSoup / ACE.js
Created January 22, 2013 05:02
Simple example on how to use the ACE Editor
var dom = require("ace/lib/dom");
require("ace/commands/default_commands").commands.push({
name: "Toggle Fullscreen",
bindKey: "F11",
exec: function(editor) {
dom.toggleCssClass(document.body, "fullScreen");
dom.toggleCssClass(editor.container, "fullScreen");
editor.resize();
}
@CrowderSoup
CrowderSoup / minify.php
Created December 7, 2012 19:32
Css Minification on the Fly
<?php
require_once('../includes/utils.php');
/**
* minify
*
* Class that handles the minification of all required CSS files
*/
class minify
@CrowderSoup
CrowderSoup / index.php
Created November 28, 2012 20:38
PHP array_map() example
<?php
$stuff = array('Bean', 'Apple', 'Tree');
$stuff = array_map('strtolower', $stuff);
var_dump($stuff);
?>
@CrowderSoup
CrowderSoup / app.js
Created November 3, 2012 17:23
Clear a Form with jQuery
function cancelForm(formName) {
$("#" + formName)[0].reset();
}
@CrowderSoup
CrowderSoup / PrintArray.php
Created October 26, 2012 02:49
Better var_dump for Arrays
function PrintArray($aVals)
{
echo "<ul>";
foreach($aVals as $key => $val)
{
if(is_array($val))
{
echo "<li><strong>{$key}</strong>";
PrintArray($val);
echo "</li>";
@CrowderSoup
CrowderSoup / 301.php
Created September 15, 2012 21:24
Simple PHP Redirect
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://example.com');
?>