Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Aaron3

View GitHub Profile
View findOutIfNamespaceIsComposerLoaded.php
<?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 Sep 4, 2013
Cleanup everything dumb authors can screw up on a website. (Keeping the rules readable. Efficiency be damned)
View cleanup_annoying_writers.php
<?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
View phpforeach.php
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 Dec 16, 2015 — forked from can3p/gist:1787188
Jquery parse query string built from .serialize() or .param() to object.
View parseParams
/**
* 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 Dec 16, 2015 — 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/
View Default (Linux).sublime-keymap
[
{ "keys": ["ctrl+shift+e"], "command": "open_folder_in_nautilus" }
]
You can’t perform that action at this time.