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
@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 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';
<?php
/**
* Using transients on a single loop inside WordPress
*
* @link http://speckyboy.com/2011/12/14/website-speed-part-3-caching-wordpress/
**/
$loop = get_transient( 'loop' );
if ( false === $loop ) {
// Show the last 100 tweets from the custom post type tweets.
@yoanmarchal
yoanmarchal / ios-web-app.html
Created June 25, 2013 19:46 — forked from tfausak/ios-8-web-app.html
meta apple / android favicon
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="yes" name="apple-mobile-web-app-capable">
<title>iOS Web App</title>
<!-- iPhone -->
@yoanmarchal
yoanmarchal / responsive.css
Created January 9, 2013 14:01 — forked from arielsalminen/responsive.css
responsive slider css + jquery
#slideshow {
width: 100%;
position: relative;
}
img {
top: 0;
left: 0;
width: 100%;
max-width: 600px;
@yoanmarchal
yoanmarchal / dabblet.css
Created December 18, 2012 20:14 — forked from LeaVerou/dabblet.css
Scrolling shadows by @kizmarh and @LeaVerou
/**
* Scrolling shadows by @kizmarh and @leaverou
* Only works in browsers supporting background-attachment: local; & CSS gradients
* Degrades gracefully
*/
html {
background: white;
font: 120% sans-serif;
}
@yoanmarchal
yoanmarchal / file-upload-handler.php
Created November 20, 2012 13:59 — forked from daltonrooney/file-upload-handler.php
Multi-file WordPress uploads from the front-end
<?php /* This function attaches the image to the post in the database, add it to functions.php */
function insert_attachment($file_handler,$post_id,$setthumb='false') {
// check to make sure its a successful upload
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');
@yoanmarchal
yoanmarchal / youtube-vimeo-embed-urls.php
Created November 7, 2012 10:50 — forked from cballou/youtube-vimeo-embed-urls.php
PHP Function to Convert Youtube and Vimeo URLs to Lightbox-Ready Equivalents
<?php
/**
* Given a string containing any combination of YouTube and Vimeo video URLs in
* a variety of formats (iframe, shortened, etc), each separated by a line break,
* parse the video string and determine it's valid embeddable URL for usage in
* popular JavaScript lightbox plugins.
*
* In addition, this handler grabs both the maximize size and thumbnail versions
* of video images for your general consumption. In the case of Vimeo, you must
* have the ability to make remote calls using file_get_contents(), which may be
/* normal case */
@font-face {
font-family: "DejaVu Sans";
src: url(‘path-to-font-directory/DejaVuSans.eot’);
src: local(‘☺’), url("path-to-font-directory/DejaVuSans.ttf") format("truetype");
}
/* bold */
@font-face {
font-family: "DejaVu Sans";
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">