Skip to content

Instantly share code, notes, and snippets.

View R3V1Z3's full-sized avatar

R3V1Z3 R3V1Z3

  • Los Angeles, CA
View GitHub Profile
@R3V1Z3
R3V1Z3 / wp-gist-shortcode.php
Last active August 29, 2015 14:04
Very simple shortcode to easily add gists in WordPress using the url for reference. All it does is wrap the specified url with the script tags needed.
<?php
// [gist url="https://gist.github.com/Ugotsta/49d45a54022f00060f71"]
function gist_function( $atts ) {
$a = shortcode_atts( array(
'url' => 'https://gist.github.com/Ugotsta/49d45a54022f00060f71'
), $atts );
return '<script src="' . esc_attr($a['url']) . '.js"></script>';
}
add_shortcode( 'gist', 'gist_function' );
@R3V1Z3
R3V1Z3 / wp-unrendered.php
Last active August 29, 2015 14:04
Shortcode to easily display unrendered shortcodes in WordPress content. It just wraps the specified shortcode parameter with the shortcode tags like [shortcode].
<?php
// [unrendered shortcode="shortcode"]
function unrendered_function( $atts ) {
$a = shortcode_atts( array(
'shortcode' => 'shortcode'
), $atts );
return '[' . esc_attr($a['shortcode']) . ']';
}
add_shortcode( 'unrendered', 'unrendered_function' );
@R3V1Z3
R3V1Z3 / phpinfo-shortcode.php
Created October 21, 2014 02:32
Dead simple, a shortcode for displaying phpinfo() through the front-end. Silly but something I like. :)
<?php
//[phpinfo]
function phpinfo_shortcode( $atts ){
return phpinfo();
}
add_shortcode( 'phpinfo', 'phpinfo_shortcode' );
?>
@R3V1Z3
R3V1Z3 / app_schedule_logged_in_user.php
Created December 11, 2014 03:22
Shortcode for use with WPMU DEV Appointments+ to show scheduling form with the logged in user's id as the service provider
// displays an Appointments+ scheduling form using the logged in user's id as the worker id
// [app_schedule_logged_in_user]
function app_schedule_logged_in_user_shortcode( $atts ) {
$user_id = get_current_user_id();
if ($user_id == 0) {
return 'You are currently not logged in.';
} else {
return do_shortcode( '[app_schedule worker="' . $user_id . '"]' );
}
}
@R3V1Z3
R3V1Z3 / membership-body-class.php
Created January 27, 2015 04:45
Add body class for WPMU DEV Membership access levels
<?php
add_filter('body_class', 'membership_body_class');
function membership_body_class($classes) {
if ( is_user_logged_in() ) {
$member = new Membership_Model_Member( get_current_user_id() );
if( $member->is_member() ) {
$classes[] = 'm-is-member';
$level_array = $member->get_level_ids();
$levels = array();
@R3V1Z3
R3V1Z3 / cp-instructor-notifications.php
Created March 17, 2015 18:39
CoursePress Instructor Notifications - to email instructors when students enroll in a course
<?php
/**
* Plugin Name: CoursePress Instructor Notifications
* Plugin URI: http://premium.wpmudev.org/forums/topic/is-coursepress-pro-able-to-send-notifications-to-teachers-about-enrollmentassignments#post-774620
* Description: Send email notices to instructors when a studen enrolls in a course
* Version: 1.0.0
* Author: Hoang (Incsub)
* Author URI: http://premium.wpmudev.org/
*/
@R3V1Z3
R3V1Z3 / install_cool_retro_term.sh
Last active August 29, 2015 14:21
Quick script to install Cool Retro Term on Ubuntu 14.x or derivates. More about Cool Retro Term at https://github.com/Swordfish90/cool-retro-term
#!/bin/bash
sudo apt-add-repository ppa:bugs-launchpad-net-falkensweb/cool-retro-term
sudo apt-get update
sudo apt-get install cool-retro-term
@R3V1Z3
R3V1Z3 / build_radium.sh
Last active August 29, 2015 14:21
Script to compile Radium from git source, for Ubuntu 14.x and derivatives like Elementary OS. Details at https://github.com/kmatheussen/radium
#!/bin/bash
# install dependencies
sudo apt-get install libqt4-dev qt4-dev-tools libxaw7-dev libasound2-dev libjack-jackd2-dev libsamplerate-dev liblrdf-dev libsndfile-dev ladspa-sdk libglib2.0-dev calf-plugins binutils-dev libc6-dev tk8.5 libogg-dev libvorbis-dev libspeex-dev fftw-dev fftw3-dev libxkbfile-dev cmake clang libfreetype6-dev libxinerama-dev libxcursor-dev libiberty-dev guile-2.0 xutils-dev
# if python 2 is not already installed, uncomment the next 3 lines:
#sudo add-apt-repository ppa:fkrull/deadsnakes
#sudo apt-get update
#sudo apt-get install python2.7
#!/bin/bash
mkdir -p ~/.config/QtProject/qtcreator/styles/
cd ~/.config/QtProject/qtcreator/styles/
wget https://raw.githubusercontent.com/procedural/qtcreator-themes/master/twilight.xml https://raw.githubusercontent.com/procedural/qtcreator-themes/master/monokai.xml https://raw.githubusercontent.com/procedural/qtcreator-themes/master/dusk.xml
@R3V1Z3
R3V1Z3 / twighlight.scheme
Created May 27, 2015 18:25
Twilight color scheme by Michael Sheets, ported to Introjucer tool in JUCE SDK at http://www.juce.com/
<?xml version="1.0" encoding="UTF-8"?>
<COLOUR_SCHEME font="Droid Sans Mono; 14.0 ">
<COLOUR name="Main Window Bkgd" colour="FF181818"/>
<COLOUR name="Treeview Highlight" colour="FF43463F"/>
<COLOUR name="Code Background" colour="FF181818"/>
<COLOUR name="Line Number Bkgd" colour="0FAAAAAA"/>
<COLOUR name="Line Numbers" colour="84AAAAAA"/>
<COLOUR name="Plain Text" colour="FFAAAAAA"/>
<COLOUR name="Selected Text Bkgd" colour="FF43463F"/>