Skip to content

Instantly share code, notes, and snippets.

View QuantaTec's full-sized avatar

QuantaTec QuantaTec

View GitHub Profile
@QuantaTec
QuantaTec / swipe.js
Created September 25, 2017 13:29 — forked from akmur/swipe.js
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.changedTouches[0].pageX;
touchstartY = event.changedTouches[0].pageY;
@QuantaTec
QuantaTec / VideoPlayer.html
Created August 9, 2017 21:18 — forked from jaydenseric/VideoPlayer.html
A simple HTML5 video player.
<figure class="video-player">
<video preload="none" width="1280" height="720" poster="video.jpg">
<source src="video.webm" type="video/webm" />
<source src="video.mp4" type="video/mp4" />
</video>
<button class="play-toggle">Toggle play</button>
<button class="mute-toggle">Toggle mute</button>
</figure>
<script>
// Initialize video player
@QuantaTec
QuantaTec / swiper-magnific-popup.js
Created August 4, 2017 10:31 — forked from thiagoeliasr/swiper-magnific-popup.js
Adding swipe support to Magnific Popup galleries. (touchSwipe is required: http://labs.rampinteractive.co.uk/touchSwipe/demos/)
(function() {
/* Define a variável que dá swipe no lightbox */
var magnificPopup = $.magnificPopup.instance;
/* Carrega a função quando clica no lightbox (senão não pega a classe utilizada) */
$("a.image-lightbox").click(function(e) {
/* Espera carregar o lightbox */
setTimeout(function() {
/* Swipe para a esquerda - Próximo */
@QuantaTec
QuantaTec / shortcode_helpers.php
Last active November 23, 2016 14:11
Temp - Shortcode Helpers for Unyson
<?php
/*
* =============================================================================
* Can Support Shortcode
* =============================================================================
* =============================================================================
*/
function qt_core_can_support_shortcode() {
@QuantaTec
QuantaTec / qt_theme_ph_add_current_nav_class.php
Last active September 14, 2016 10:19
Add menu item highlight support for Property Listing Archive page
<?php
/*
* =============================================================================
* Add menu item highlight support for PropertyHive Listing / Archive page
* =============================================================================
* =============================================================================
*/
function qt_theme_ph_add_current_nav_class( $classes, $item ) {
@QuantaTec
QuantaTec / gist:23d046cb7e313aed4c35006cb6c99808
Created April 13, 2016 21:46 — forked from hissy/gist:7352933
[WordPress] Add file to media library programmatically
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
@QuantaTec
QuantaTec / plugin.php
Created April 8, 2016 17:25 — forked from kevinwhoffman/plugin.php
Dependent Plugin Activation/Deactivation and Alert
<?php
/*
* Dependent Plugin Activation/Deactivation
*
* Sources:
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/
*
*/