Skip to content

Instantly share code, notes, and snippets.

View robertox85's full-sized avatar

Roberto Di Marco robertox85

View GitHub Profile
@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);
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
@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 );
@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);
@alexcican
alexcican / flexbox.css
Last active July 9, 2016 09:39
Centring a div vertically and horizontally with CSS Flexbox (tested on Chrome 30, Safari 6, Firefox 24, Mobile Safari iOS 7, Mobile IE 10)
.parent {
display: flex;
height: 500px;
}
.child {
max-width: 20em;
margin: auto;
border: solid 1px;
}
@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.

@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)) {
@alexcican
alexcican / style.css
Created March 8, 2013 22:24
Useful CSS snippet for creating a new website. Sets typography for vertical rhythm and icon font for icons, as well as mobile, tablet, and large screen query. Based on 32px baseline height and 22px font-size for body.
/*** GLOBAL ***/
/**************/
img, embed, object, video {
max-width: 100%;
}
@font-face {
font-family: 'sicanstudios-icons';
src:url('./fonts/sicanstudios-icons.eot');
}
@alexcican
alexcican / fadein-scroll.js
Created February 5, 2013 21:41
Snippet for fading in content as you scroll
$(document).ready(function() {
/* Every time the window is scrolled ... */
$(window).scroll( function(){
/* Check the location of each desired element */
$('.hideme').each( function(i){
var bottom_of_object = $(this).position().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it it */
if( bottom_of_window > bottom_of_object ){