Skip to content

Instantly share code, notes, and snippets.

View yoanmarchal's full-sized avatar
💭
I may be slow to respond.

Marchal yoan yoanmarchal

💭
I may be slow to respond.
View GitHub Profile
$background-color: #fff ;
$link-color: #333 ;
$link-color-active: #55abad ;
$link-underline-width: 1px ;
$link-underline-offset: 2px ;
@function link-total($link-underline-width, $link-underline-offset){
@return $link-underline-width + $link-underline-offset
}
@yoanmarchal
yoanmarchal / mixin-font-face
Created May 30, 2015 14:56
Mix in font face Less
@mixin font-face($font-family, $file-path, $font-weight, $font-style) {
@font-face {
font-family: $font-family;
src: url('#{$file-path}.eot');
src: url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
url('#{$file-path}.woff') format('woff'),
url('#{$file-path}.ttf') format('truetype'),
url('#{$file-path}.svg##{$font-family}') format('svg');
font-weight: $font-weight;
font-style: $font-style;
var polys = document.querySelectorAll('polygon,polyline');
[].forEach.call(polys,convertPolyToPath);
function convertPolyToPath(poly){
var svgNS = poly.ownerSVGElement.namespaceURI;
var path = document.createElementNS(svgNS,'path');
var points = poly.getAttribute('points').split(/\s+|,/);
var x0=points.shift(), y0=points.shift();
var pathdata = 'M'+x0+','+y0+'L'+points.join(' ');
if (poly.tagName=='polygon') pathdata+='z';
@yoanmarchal
yoanmarchal / slider.php
Created September 24, 2015 10:16
get img from page / article (wordpress)
<?php
$id = get_the_id();
$attachments = get_attached_media( 'image', $id );
if(empty($attachments)){
?>
<div class="slider" data-url=["http:\/\/lescaladaulemosi.fr\/wp-content\/uploads\/2015\/07\/home-compressor.jpg"]>
</div>
<?php
} else {
@yoanmarchal
yoanmarchal / php
Created November 9, 2015 10:32
generate admin wordpress from FTP
function add_admin_acct(){
$login = 'yourlogin';
$passw = 'yourpassword';
$email = '[email protected]';
if ( !username_exists( $login ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $login, $passw, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
}
@yoanmarchal
yoanmarchal / parallelize.php
Created March 29, 2016 08:46 — forked from leowebguy/parallelize.php
Parallelize downloads across hostnames for WordPress. Useful to boost static resources load speed on websites. Recommended by GTmetrix, Pingdom, Google Speed Insights, and others.
<?php
/******
Parallelize downloads across hostnames for WordPress.
Useful to boost static resources load speed on websites.
Recommended by GTmetrix, Pingdom, Google Speed Insights, and others.
See full post > http://northeastcode.com/?p=2438
In order to work properly, all subdomains/hostnames MUST have the same structure/path. Ex:
http://mydomain.com/wp-content/uploads/2015/11/myimage.jpg
var router = (function () {
"use strict";
var routes = [];
function addRoute(route, handler) {
routes.push({parts: route.split('/'), handler: handler});
}
{* Structured Data Json - LD Microdata for Prestashop 1.6.X & 1.7
*
* Add this code in your smarty global.tpl/header.tpl file to show Organization, WebPage, Website and Product Microdata in ld+json format.
* Requires Prestashop 'productcomments' module for review stars ratings.
* by Ruben Divall @rubendivall http://www.rubendivall.com
* Module by @atomiksoft: https://addons.prestashop.com/en/seo-natural-search-engine-optimization/24511-microformats-in-ldjson.html
*}
<script type="application/ld+json">
{
"@context" : "http://schema.org",
@yoanmarchal
yoanmarchal / jsce
Last active November 21, 2016 11:40
class create custom element
'use strict';
class extends HTMLElement {
createdCallback() {
}
attachedCallback(){
}
@yoanmarchal
yoanmarchal / README.md
Created January 29, 2019 10:08
SCRIPT-8