Skip to content

Instantly share code, notes, and snippets.

@neovea
neovea / SwitchButton.js
Created October 6, 2017 09:13
Switch button
class SwitchButton {
constructor () {
this.switchButton = null
}
init (button) {
this.switchButton = button
this.switchInput = this.switchButton.getElementsByTagName('input')
this.blockBasic = document.querySelectorAll('.basic-display')
@neovea
neovea / StickyDomScroll.js
Created October 6, 2017 09:12
Make DOM element sticky on scroll
/**
* STICKY FILTERS
*/
class StickyDomScroll {
constructor () {
this.selector = null
this.initialPosition = null
this.parentDiv = null
this.newElement = document.createElement('div')
this.initialPosition = null
@neovea
neovea / defer_jquery.js
Last active July 18, 2017 09:51
Wainting for jQuery to be loaded before execution jQuery code
(function() {
var timer = setTimeout(function() {
if (window.jQuery) {
clearTimeout(timer);
// Jquery code goes here
}
}, 50)
})();
* {
box-sizing: border-box;
}
html, body {
margin: 0;
}
@mixin animation() {
transition-duration: 0.5s;
@neovea
neovea / button.html
Created April 28, 2016 07:52
Button for emails / outlook / gmail
<div style="text-align: center">
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://www.censier-publicinex.fr/creez-votre-film-publicitaire-cinema-en-ligne/" style="height:40px;v-text-anchor:middle;width:300px;" arcsize="10%" strokecolor="#D33228" fillcolor="#D33228">
<w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:13px;font-weight:bold;">Créez votre vidéo dès maintenant !</center>
</v:roundrect>
<![endif]--><a href="http://www.censier-publicinex.fr/creez-votre-film-publicitaire-cinema-en-ligne/"
style="background-color:#D33228;border:1px solid #D33228;border-radius:4px;color:#ffffff;display:inline-block;font-family:sans-serif;font-size:13px;font-weight:bold;line-height:40px;text-align:center;text-decoration:none;width:300px;-webkit-text-size-adjust:none;mso-hide:all;">Créez votre vidéo dès maintenant !</a>
</div>
@neovea
neovea / iframe.css
Created May 19, 2015 13:33
Responsive video iframe
.vid-player {
position: relative;
padding-bottom: 56.25%;
padding-top: 35px;
height: 0;
overflow: hidden;
}
.vid-player iframe {
position: absolute;
top:0;
@neovea
neovea / resizeIframe.js
Last active August 29, 2015 14:19
Responsive iframe for youtube or any embeded content
function resizeIframe() {
if ( $('iframe') ) {
var iframe = $('iframe');
iframe.each(function(){
var parent = $(this).parent();
var ratio = $(this).attr('width') / $(this).attr('height');
$(this).attr('width', parent.width());
$(this).attr('height', parent.width()/ratio);
});
}
@neovea
neovea / index.html
Last active August 29, 2015 14:18
Simple 12 cols fluid grid system
<div id="wrapper">
<div class="row">
<div class="col12"></div>
</div>
<div class="row">
<div class="col6"></div>
<div class="col6"></div>
</div>
<div class="row">
<div class="col4"></div>
@neovea
neovea / wc_adaptive_payment_custom_args.php
Last active September 1, 2016 17:55 — forked from claudiosanches/functions.php
Combined to WooCommerce Adaptive Payment by WooTheme, offers the possibility to create dynamic amounts for specific paypal accounts. Put this snippet into functions.php
<?php
/**
* Custom PayPal Adaptive Payments args.
*
* @param array $args
* @param WC_Order $order
* @return array
*/
function wc_adaptive_payment_custom_args( $args, $order ) {
$args['receiverList'] = array(
@neovea
neovea / wc_get_product_category.php
Last active August 29, 2015 14:08
Get a specific category obj depending on the field (name, slug or id) and the value of the field.
<?php
/**
* Return a product obj depending on field and value
* Authorised fields : term_id, name, slug
* @author Franck LEBAS
* @param string $field
* @param string $value
* @return obj, array or string $response
*/
function wc_get_product_category($field, $value) {