Skip to content

Instantly share code, notes, and snippets.

View neojp's full-sized avatar

Joan P. neojp

View GitHub Profile
@neojp
neojp / jquery-gsap-easings.js
Created May 29, 2014 18:50
Let jQuery use Greensock's Easings
var jQueryGsapEasings = function() {
var _createEase = function(ease) {
return function(p) {
return ease.getRatio(p);
};
},
_easeMap = Ease.map || {};
if ($.easing) {
for (var p in _easeMap) {
@neojp
neojp / gist:9006936
Created February 14, 2014 19:02
Query for upcoming posts on "The Events Calendar" WordPress plugin
<?php
// https://github.com/moderntribe/the-events-calendar/blob/master/lib/tribe-event-query.class.php
$q = TribeEventsQuery::getEvents(array(
'eventDisplay' => 'upcoming',
'posts_per_page' => 3
));
var_dump($q);
@neojp
neojp / custom-debug-bar-panel-class.php
Created January 20, 2014 19:54
WordPress - Debug Bar Panel class
<?php
Class CustomDebugBarPanel extends Debug_Bar_Panel {
public function init() {
$this->title(__('Custom Debug Bar Panel', 'debug-bar'));
add_action('wp_print_styles', array( $this, 'print_styles'));
add_action('admin_print_styles', array( $this, 'print_styles'));
}
public function prerender() {
@neojp
neojp / gist:5678717
Created May 30, 2013 15:21
Refresh the Upstart scripts index on Ubuntu
# initctl reload-configuration
@neojp
neojp / gist:5561946
Created May 12, 2013 00:42
How to install Node.js & NPM on CentOS 6.4
# rpm -Uvh http://epel.mirror.constant.com/6/i386/epel-release-6-8.noarch.rpm
# yum --enablerepo=epel-testing install npm
@neojp
neojp / widget-css-classes.class.php
Created October 9, 2012 15:49
Wordpress CSS Classes - Widget Context support
// http://wordpress.org/extend/plugins/widget-css-classes/developers/
// widget-css-classes/includes/widget-css-classes.class.php - Line 97
// if Widget Logic plugin is enabled, use it's callback
if ( in_array( 'widget-logic/widget_logic.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
$widget_opt = get_option( $widget_obj['callback_wl_redirect'][0]->option_name );
// if Widget Context plugin is enabled, use it's callback
} elseif ( in_array( 'widget-context/widget-context.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
$widget_opt = get_option( $widget_obj['callback_original_wc'][0]->option_name );
/*
* Simple javascript mobile OS / iphone/ android detector
*
* License: GPLv3+
* Author: justin.kelly.org.au
*
*/
$(document).ready(function() {
var deviceIphone = "iphone";
@neojp
neojp / assets.php
Created March 21, 2012 18:50
Enqueue WordPress static assets with dynamic versioning passed over in the query string.
// enqueue local theme assets
function _enqueue_assets($css, $js) {
// add files to the $css or $js arrays like this
// 'handle' => 'js/filename.js'
//
// or like this
// 'handle' => array(
// 'src' => 'js/filename.js', // don't start with /
// 'deps' => null, // can be string or array of strings
// 'version' => null,
@neojp
neojp / classses.styl
Created March 2, 2012 15:40
Stylus: Image replacement mixin
// Image replacement
ir()
width = arguments ? arguments[0] : 100%
height = arguments && arguments[1] ? arguments[1] : false
height = height ? height : width
direction ltr
display block
height height
overflow hidden
@neojp
neojp / coffee.sh
Created February 19, 2012 21:09
Watch and auto update a Node.js app in Coffeescript with Supervisor.
coffee -wc app.coffee