Skip to content

Instantly share code, notes, and snippets.

View bepatrickdavid's full-sized avatar

bepatrickdavid bepatrickdavid

View GitHub Profile
@bepatrickdavid
bepatrickdavid / youtube.scss
Created May 24, 2017 14:38
SASS: video youtube iframe 16:9 responsive
.wrap-video {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
iframe {
position: absolute;
top: 0;
left: 0;
@bepatrickdavid
bepatrickdavid / tabs.html
Created September 14, 2017 14:36
JS: Simple Tab - tabs
<script>
$('.ttabs').on("click", " .ttab", function () {
$(this).siblings().removeClass('active');
$(this).addClass('active');
var tabID = $(this).attr('data-ttab');
var tabSelected = $(this).closest('.ttabs-wrap').find("[data-ttab='" + tabID + "']");
tabSelected.siblings().removeClass('active');
tabSelected.addClass('active');
@bepatrickdavid
bepatrickdavid / demo.js
Created November 20, 2017 07:55
JS: Scroll between section smooth scrolling anchor js
/*-------------------------------------------------*/
/* = Scroll between sections
/*-------------------------------------------------*/
var $root = $('html, body');
$('a.anchor[href*=#]').on("click",function(event) {
event.preventDefault();
var offset = -150;
@bepatrickdavid
bepatrickdavid / gist:60b6b1d7659afd99fec8919d8d313f11
Last active December 21, 2017 09:02
.htaccess redirect 301
RewriteEngine On
Redirect 301 pagina1.html http://www.miosito.com/pagina2.html
@bepatrickdavid
bepatrickdavid / index.php
Created December 31, 2017 11:11
PHP: redirect 301 only home
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: https://newlocation/" );
?>
@bepatrickdavid
bepatrickdavid / es3.php
Created April 10, 2018 17:36
PHP: ordinare array di oggetti
//$d è un oggetto stdClass
//$newd = new stdClass;
//$newd->ID = "MAIN";
//$newd->NAME = "Look - The Concept Factory";
//$newd->ADDRESS = "Zona industriale Villanova, 19 32013 Longarone (BL) ITALY";
//$newd->TEL = "+390437573060";
//$newd->MAIL = "info@lookocchiali.it";
//$newd->WEBSITE = "www.lookocchiali.it";
//$newd->DISTANCE = "";
@bepatrickdavid
bepatrickdavid / gist:43788b11a82c11c3cbdaad9877c4edba
Created March 1, 2019 16:38
.htaccess - block specific url deny url
My url: https://www.test.com/inc/example.xml
RewriteRule ^inc/example.xml - [F]
@bepatrickdavid
bepatrickdavid / .htaccess
Created May 6, 2019 09:03
Simple .htaccess https redirect
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@bepatrickdavid
bepatrickdavid / .htaccess
Created October 16, 2019 11:59
.htaccess: rewrite html extension and redirect to subfolder lang
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# redirect to subfolder /it if language is it
RewriteCond %{HTTP:Accept-Language} ^it [NC]
RewriteRule ^/?$ https://domain.com/it/ [R,NC,L]
# remove the .html extension
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.html\ HTTP
RewriteRule (.*)\.html$ $1 [R=301]
@bepatrickdavid
bepatrickdavid / index.php
Created November 26, 2019 09:16
WP: [Query] exclude latest post from the wordpress post loop with pagination
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' => 8,
'paged' => $paged,
'post__not_in' => array($idPostToExlude) );
$the_query = new WP_Query( $args );