Skip to content

Instantly share code, notes, and snippets.

WPsites

Block or report user

Report or block WPsites

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@WPsites
WPsites / gist:4128809
Created Nov 22, 2012
Hide admin menu items on a WordPress site.
View gist:4128809
<?php
/*
The code below hides the admin menu items for all users that don't have the 'manage_sites' capability.
On multisite that would mean only Super Admins can look at those menu items
This script only removes the menu items so users can still look at the page if they know the path, but it de-clutters the admin
*/
global $current_user;
if ( !current_user_can('manage_sites') ) {
@WPsites
WPsites / editor-style.css
Created Oct 23, 2012
WordPress tinymce style dropdown
View editor-style.css
/*
editor styles
*/
.Bold{
font-weight:bold;
}
.Medium{
@WPsites
WPsites / gist:3935417
Created Oct 22, 2012
WPMU Gravity Form functions.php
View gist:3935417
<?php
/*
Filter the gravity form shortcode output to retreive the form from the main site
*/
add_filter('gform_shortcode_form', 'gform_shortcode_form_mu_override',10,3);
function gform_shortcode_form_mu_override( $shortcode_string, $attributes, $content ){
@WPsites
WPsites / build-shape-detect.sh
Created Sep 12, 2012
Find contours in an image and output x,y data structure of all found contours (OpenCV)
View build-shape-detect.sh
#!/bin/sh
i="shape-detect.cpp"
echo "compiling $i"
g++ -ggdb `pkg-config --cflags opencv` -o `basename $i .cpp` $i `pkg-config --libs opencv`;
@WPsites
WPsites / D3.js
Created Sep 12, 2012
D3.JS playground - UK map made of around 300 dots
View D3.js
var svg = createSVG();
// Associate each circle with a unique ID so that exit()
// and updates properly affect the correct element.
var circle = svg.selectAll("circle").data($data,ƒ('id'));
circle.enter().append('circle')
.attr('opacity',0)
.attr('class',"m")
.attr("cx", ƒ('x'))
@WPsites
WPsites / gist:3656189
Created Sep 6, 2012
WP-cron debug test - Add a WordPress cron event to email server variables every 2 minutes
View gist:3656189
<?php
function my_additional_schedules($schedules) {
// interval in seconds
$schedules['every2min'] = array('interval' => 2*60, 'display' => 'Every two minutes');
return $schedules;
}
add_filter('cron_schedules', 'my_additional_schedules');
// schedule the wp_cron_testing
@WPsites
WPsites / gist:3490133
Created Aug 27, 2012
Apache + APC opcode cache : subsequent request for a soft linked PHP file (it's coming from the opcode cache)
View gist:3490133
accept(3, {sa_family=AF_INET, sin_port=htons(44640), sin_addr=inet_addr("10.176.133.135")}, [16]) = 15
fcntl(15, F_GETFD) = 0
fcntl(15, F_SETFD, FD_CLOEXEC) = 0
gettimeofday({1345995218, 826638}, NULL) = 0
fcntl(15, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(15, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1345995218, 826856}, NULL) = 0
gettimeofday({1345995218, 826937}, NULL) = 0
gettimeofday({1345995218, 827007}, NULL) = 0
read(15, "GET /simon-soft2.php HTTP/1.0\r\nX"..., 8000) = 1374
@WPsites
WPsites / gist:3490122
Created Aug 27, 2012
Apache + APC opcode cache : initial request for a soft linked PHP file (symlink)
View gist:3490122
accept(3, {sa_family=AF_INET, sin_port=htons(39290), sin_addr=inet_addr("10.176.133.135")}, [16]) = 15
fcntl(15, F_GETFD) = 0
fcntl(15, F_SETFD, FD_CLOEXEC) = 0
gettimeofday({1345995403, 39206}, NULL) = 0
fcntl(15, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(15, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1345995403, 39418}, NULL) = 0
gettimeofday({1345995403, 39492}, NULL) = 0
gettimeofday({1345995403, 39557}, NULL) = 0
read(15, "GET /simon-soft2.php HTTP/1.0\r\nX"..., 8000) = 1374
@WPsites
WPsites / gist:3490094
Created Aug 27, 2012
Apache + APC opcode cache : subsequent request for a hard linked PHP file (it's coming from the opcode cache)
View gist:3490094
accept(3, {sa_family=AF_INET, sin_port=htons(44590), sin_addr=inet_addr("10.176.133.135")}, [16]) = 15
fcntl(15, F_GETFD) = 0
fcntl(15, F_SETFD, FD_CLOEXEC) = 0
gettimeofday({1345995128, 111295}, NULL) = 0
fcntl(15, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(15, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1345995128, 111533}, NULL) = 0
gettimeofday({1345995128, 111612}, NULL) = 0
gettimeofday({1345995128, 111682}, NULL) = 0
read(15, "GET /simon-hard.php HTTP/1.0\r\nX-"..., 8000) = 1373
@WPsites
WPsites / gist:3490077
Created Aug 27, 2012
Apache + APC opcode cache : initial request for a hard linked PHP file
View gist:3490077
accept(3, {sa_family=AF_INET, sin_port=htons(39263), sin_addr=inet_addr("10.176.133.135")}, [16]) = 15
fcntl(15, F_GETFD) = 0
fcntl(15, F_SETFD, FD_CLOEXEC) = 0
gettimeofday({1345995352, 860155}, NULL) = 0
fcntl(15, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(15, F_SETFL, O_RDWR|O_NONBLOCK) = 0
gettimeofday({1345995352, 860364}, NULL) = 0
gettimeofday({1345995352, 860438}, NULL) = 0
gettimeofday({1345995352, 860504}, NULL) = 0
read(15, "GET /simon-hard.php HTTP/1.0\r\nX-"..., 8000) = 1373
You can’t perform that action at this time.