Skip to content

Instantly share code, notes, and snippets.

View Aaron3's full-sized avatar

Aaron Aaron3

View GitHub Profile
<?php
$namespace = 'aBase\\';
$classes = get_declared_classes();
$keys = preg_grep('/ComposerAutoloaderInit*/', $classes);
foreach ($keys as $composerLoader) {
if (method_exists($composerLoader, 'getLoader')) {
$composer = $composerLoader::getLoader();
if($composer && $composer->getPrefixesPsr4()){
if(array_key_exists($namespace, $composer->getPrefixesPsr4())){
@Aaron3
Aaron3 / cleanup_annoying_writers.php
Created September 4, 2013 14:36
Cleanup everything dumb authors can screw up on a website. (Keeping the rules readable. Efficiency be damned)
<?php
add_filter('content_save_pre', 'cleanup_annoying_writers');
function cleanup_annoying_writers($content)
{
remove_filter('content_save_pre', array($this, 'cleanup_annoying_writers'));
$content =trim(stripslashes($content));
//No JS
For a single item (say, a single article)
In your Data:
<?php
$data = array('title' => 'My Single Title', 'content' => 'My Single Content');
?>
@Aaron3
Aaron3 / parseParams
Last active December 16, 2015 18:00 — forked from can3p/gist:1787188
Jquery parse query string built from .serialize() or .param() to object.
/**
* Converts a string that was serialized with jQuery.param back to the object.
*
* @param {String} str
*
* @return {Object}
*/
function parseParams(str) {
var obj = {}, pair;
var pairs = decodeURIComponent(str).split( "&" );
@Aaron3
Aaron3 / Default (Linux).sublime-keymap
Last active December 16, 2015 03:49 — forked from hoffstein/Default (Windows).sublime-keymap
Quick script to open a file's parent folder in the file manager in ubuntu. #Install to ~/.config/sublime-text-3/Packages/User/
[
{ "keys": ["ctrl+shift+e"], "command": "open_folder_in_nautilus" }
]