Skip to content

Instantly share code, notes, and snippets.

View robertox85's full-sized avatar

Roberto Di Marco robertox85

View GitHub Profile
@strangerstudios
strangerstudios / gist:3111478
Last active April 23, 2024 12:52
Lockdown BuddyPress with Paid Memberships Pro Example
<?php
/*
Plugin Name: PMPro BuddyPress Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-buddypress-customizations/
Description: Example code to lock down parts of BuddyPress with PMPro
Version: 0.2
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@dustinboston
dustinboston / common-media-queries.css
Created October 10, 2012 18:29
Common Media Queries
/* This is a small sampling of the various approaches to media queries. The
point is: they're all over the board. Part of the "issue" (if you can call
it that) may be due to the intended audience of each site/framework. Another
may be that it's really difficult to test for a lot of different devices.
Regardless, it would be really nice if there was standard baseline that
could be used as a starting point for maximum compatibility and coverage. */
/* ==========================================================================
Frameworks
========================================================================== */
@firasd
firasd / functions.php
Created May 24, 2018 21:52
Remove 'Mark Complete' button from lesson pages in Learndash course
<?php
add_filter('learndash_mark_complete', function($return, $post) {
$course_hide_markcomplete = 0;
if(learndash_get_course_id($post->ID) == $course_hide_markcomplete) {
$return = '';
}
return $return;
}, 10, 2);
@adamjimenez
adamjimenez / gist:5917897
Created July 3, 2013 13:36
Generate thumbnails from video files using HTML5's video tag and canvas
<?php
//where you want your thumbnails to go
$thumbs_dir = 'uploads/thumbs/';
//this should be an array of video paths
$videos = array();
if( $_POST["name"] ){
// Grab the MIME type and the data with a regex for convenience
if (!preg_match('/data:([^;]*);base64,(.*)/', $_POST['data'], $matches)) {
@ingdir
ingdir / gist:0b211b9253c376f9cfa5
Last active December 3, 2023 11:47
BEM Cheatsheet

BEM Cheatsheet

BLOCK

Block encapsulates a standalone entity that is meaningful on its own.

While blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy.

Holistic entities without DOM representation (such as controllers or models) can be blocks as well.

@tiltos
tiltos / gist:2042540
Created March 15, 2012 06:36
WP: Get custom taxonomy parent
<?php
$term = get_the_terms( $post->ID, 'custom-taxonomy' );
foreach ($term as $key) {
$parents = get_ancestors( $key->term_id, 'custom-taxonomy' );
foreach ($parents as $parent) {
$key = get_term($parent, 'custom-taxonomy');
$parent = $key->slug;
}
}
echo $parent;
@rxnlabs
rxnlabs / php-array-get-all-possibilities-associative.php
Last active July 22, 2019 10:38
PHP - Generate all possible combinations from multidimensional array
// http://www.devnetwork.net/viewtopic.php?f=1&t=133156
function array_cartesian_utm($arrays){
//returned array...
$cartesic = array();
//calculate expected size of cartesian array...
$size=(sizeof($arrays)>0)?1:0;
foreach($arrays as $array){
$size= $size*sizeof($array);
@lukecav
lukecav / functions.php
Created June 21, 2017 14:13
How to remove WordPress version parameter from JS and CSS files
// remove wp version param from any enqueued scripts
function vc_remove_wp_ver_css_js( $src ) {
if ( strpos( $src, 'ver=' . get_bloginfo( 'version' ) ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
function checkAvailability() {
var dataLezione = $("#dateTime").val();
var start = $('#oraInizio').val();
var end = $("#oraFine").val();
$.post("ajax/stanze/availability.php", {
'start': dataLezione + ' ' + start,
'end': dataLezione + ' ' + end
}).done(function(json) {
var result = jQuery.parseJSON(json);
$requete = $database->select(
'embassy_calendario',
[
"embassy_calendario.id_stanza",
"embassy_calendario.id_insegnante"
],
" WHERE
(start >= '".date("Y-m-d H:i:s", strtotime($_POST['start']))."' AND start < '".date("Y-m-d H:i:s", strtotime($_POST['end']))."') OR
(end > '".date("Y-m-d H:i:s", strtotime($_POST['start']))."' AND end <= '".date("Y-m-d H:i:s", strtotime($_POST['end']))."') OR
(start >= '".date("Y-m-d H:i:s", strtotime($_POST['start']))."' AND end <= '".date("Y-m-d H:i:s", strtotime($_POST['end']))."') OR