Skip to content

Instantly share code, notes, and snippets.

Avatar
🦄
[object Object]

Aaron Crowder CrowderSoup

🦄
[object Object]
View GitHub Profile
@CrowderSoup
CrowderSoup / 3colgrid.css
Created Jun 25, 2012
Basic 3-col CSS Grid
View 3colgrid.css
/**
* 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 Aug 9, 2012
PHP Random String Generator
View random.php
<?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 Sep 15, 2012
Simple PHP Redirect
View 301.php
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://example.com');
?>
@CrowderSoup
CrowderSoup / PrintArray.php
Created Oct 26, 2012
Better var_dump for Arrays
View PrintArray.php
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 Nov 3, 2012
Clear a Form with jQuery
View app.js
function cancelForm(formName) {
$("#" + formName)[0].reset();
}
@CrowderSoup
CrowderSoup / index.php
Created Nov 28, 2012
PHP array_map() example
View index.php
<?php
$stuff = array('Bean', 'Apple', 'Tree');
$stuff = array_map('strtolower', $stuff);
var_dump($stuff);
?>
@CrowderSoup
CrowderSoup / minify.php
Created Dec 7, 2012
Css Minification on the Fly
View minify.php
<?php
require_once('../includes/utils.php');
/**
* minify
*
* Class that handles the minification of all required CSS files
*/
class minify
@CrowderSoup
CrowderSoup / ACE.js
Created Jan 22, 2013
Simple example on how to use the ACE Editor
View ACE.js
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
A better better var_dump for arrays OR objects (or objects within arrays... or arrays within objects).
View SuperDump.php
<?php
class util
{
/**
* SuperDump()
*
* Better var_dump for Arrays and Objects. Prints an array out in a
* formatted manner.
*
@CrowderSoup
CrowderSoup / markRead.js
Created Jun 17, 2013
Mark All items as "read" in WordPress.com comment archive.
View markRead.js
jQuery('.wpn-note-summary').each(function(){jQuery(this).trigger('click');});