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 / 3colgrid.css
Created June 25, 2012 17:55
Basic 3-col CSS Grid
/**
* This is the most simple 3-col CSS grid I could imagine. It supports 3 columns of equal size with 10px margins. Feel free to modify this as
* you need.
*/
/**
* The row
*/
.row { clear: both; overflow: hidden; margin: 0 0 10px 0; }
@CrowderSoup
CrowderSoup / random.php
Created August 9, 2012 20:55
PHP Random String Generator
<?php
function get_rand_str($length)
{
$chars = array_merge(range('a','z'), range('A','Z'), array('!','@','#','$','%','&','*'));
$length = intval($length) > 0 ? intval($length) : 16;
$max = count($chars) - 1;
$str = "";
while($length--) {
shuffle($chars);
@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');
?>
@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 / app.js
Created November 3, 2012 17:23
Clear a Form with jQuery
function cancelForm(formName) {
$("#" + formName)[0].reset();
}
@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 / 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 / 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 / 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 / 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');});