Skip to content

Instantly share code, notes, and snippets.

@ChunkRadius
ChunkRadius / gist:6360391
Last active December 21, 2015 20:19
Simple fly-out menu for a WordPress sidebar menu. Supports unlimited nesting.
<script>
jQuery(function() {
if ('undefined' !== typeof submenuItems) {
submenuItems.off();
}
if ('undefined' !== typeof primaryItems) {
primaryItems.off();
}
if ('undefined' !== typeof sidebar) {
sidebar.off();
@ChunkRadius
ChunkRadius / Gulpfile.js
Last active August 29, 2015 14:02
A sample Gulpfile for use with any Go HTTP server to automatically recompile the Go binary when any file changes.Adjust the projectName and srcDir to match your project's layout. Tested on Linux (Ubuntu) but should work wherever "sh" is available.
var projectName = 'main',
srcDir = './src',
gulp = require('gulp'),
exec = require('gulp-exec');
gulp.task('serve', function() {
var opts = { continueOnError: true, pipeStdout: true },
goCmd = 'sh -c "go run ' + __dirname + '/src/*.go&"',
killCmd = 'killall -q go ' + projectName;
@ChunkRadius
ChunkRadius / anahita.php
Created July 16, 2014 14:19
Proper Anahita HTTP Authentication headers
// File anahita/anahita/src/plugins/system/anahita.php
/**
* Remebers handling
*
* @return void
*/
public function onAfterInitialise()
{
@ChunkRadius
ChunkRadius / request.php
Created July 16, 2014 17:34
Proper Anahita HTTP Authentication headers
<?php
/**
* @version $Id: request.php 4628 2012-05-06 19:56:43Z johanjanssens $
* @package Koowa_Request
* @copyright Copyright (C) 2007 - 2012 Johan Janssens. All rights reserved.
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://www.nooku.org
*/
// Filename: /vendor/anahita/anahita/vendor/nooku/libraries/koowa/request/request.php
@ChunkRadius
ChunkRadius / anahita.php
Created July 17, 2014 15:07
File www/plugins/system/anahita.php
<?php
/**
* LICENSE: ##LICENSE##
*
* @category Anahita
* @package Plugins
* @author Arash Sanieyan <ash@anahitapolis.com>
* @author Rastin Mehr <rastin@anahitapolis.com>
* @copyright 2008 - 2010 rmdStudio Inc./Peerglobe Technology Inc
@ChunkRadius
ChunkRadius / script.js
Created July 30, 2014 07:33
Promise-based JS script loader
function script(url) {
if(Array.isArray(url)) {
var self = this, prom = [];
url.forEach(function(item) {
prom.push(self.script(item));
});
return Promise.all(prom);
}
@ChunkRadius
ChunkRadius / install.sh
Last active August 29, 2015 14:07
Phalcon PHP Install Ubuntu
#!/bin/sh
git clone --depth=1 git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
echo 'extension=phalcon.so' | sudo tee --append /etc/php5/mods-available/phalcon.ini > /dev/null
sudo ln -s /etc/php5/mods-available/phalcon.ini /etc/php5/cli/conf.d/30-phalcon.ini
sudo ln -s /etc/php5/mods-available/phalcon.ini /etc/php5/apache2/conf.d/30-phalcon.ini
sudo service apache2 restart
@ChunkRadius
ChunkRadius / xdebug.ini
Created October 30, 2014 14:57
Xdebug default configuration
[xdebug]
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.idekey=PHPSTORM
xdebug.max_nesting_level=200
@ChunkRadius
ChunkRadius / alertify.js
Created November 7, 2014 17:23
Alertify JS update with fixes buggy transition support
(function (global, undefined) {
"use strict";
var document = global.document,
Alertify;
function getStyleRuleValue(style, selector, sheet) {
var sheets = typeof sheet !== "undefined" ? [sheet] : document.styleSheets;
for (var i = 0, l = sheets.length; i < l; i++) {
sheet = sheets[i];
@ChunkRadius
ChunkRadius / abstract.php
Last active August 29, 2015 14:09
/vendor/anahita/anahita/vendor/nooku/libraries/koowa/template/abstract.php
private function __sandbox()
{
set_error_handler(array($this, 'handleError'), E_WARNING | E_NOTICE);
$this->getStack()->push(clone $this);
//Extract the data in local scope
extract($this->_data, EXTR_SKIP);
// Capturing output into a buffer
ob_start();