-
-
Save yoanmarchal/e766a79592bafa9506e4 to your computer and use it in GitHub Desktop.
Revisions
-
leowebdev revised this gist
Nov 16, 2015 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ <?php /****** Parallelize downloads across hostnames for WordPress. Useful to boost static resources load speed on websites. -
leowebdev revised this gist
Nov 7, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function parallelize_hostnames($url, $id) { } function par_get_hostname($name) { $subdomains = array('media1.mydomain.com','media2.mydomain.com'); //add your subdomains here, as many as you want. $host = abs(crc32(basename($name)) % count($subdomains)); $hostname = $subdomains[$host]; return $hostname; -
leowebdev revised this gist
Nov 7, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function parallelize_hostnames($url, $id) { } function par_get_hostname($name) { $subdomains = array('media1.mydomain.com','media2.mydomain.com'); //add your subdomains here * as many as you want $host = abs(crc32(basename($name)) % count($subdomains)); $hostname = $subdomains[$host]; return $hostname; -
leowebdev revised this gist
Nov 7, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ /****** 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 -
leowebdev revised this gist
Nov 7, 2015 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ /****** Parallelize downloads across hostnames for WordPress. Useful to boost page load for static resources. 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: -
leowebdev revised this gist
Nov 7, 2015 . No changes.There are no files selected for viewing
-
leowebdev renamed this gist
Nov 7, 2015 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,14 @@ /****** Parallelize downloads across hostnames for WordPress. Very useful to speed up page speed. 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 http://media1.mydomain.com/wp-content/uploads/2015/11/myimage.jpg http://media2.mydomain.com/wp-content/uploads/2015/11/myimage.jpg Add to functions.php ******/ function parallelize_hostnames($url, $id) { -
leowebdev revised this gist
Nov 7, 2015 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ /****** Parallelize downloads across hostnames for WordPress. Very useful to speed up page speed. 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 -
leowebdev created this gist
Nov 7, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ /****** Parallelize downloads across hostnames for WordPress. Very usefull to speed up page speed. Recommended by GTmetrix, Pingdom, Google Speed Insights, and others. 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 http://media1.mydomain.com/wp-content/uploads/2015/11/myimage.jpg http://media2.mydomain.com/wp-content/uploads/2015/11/myimage.jpg ******/ function parallelize_hostnames($url, $id) { $hostname = par_get_hostname($url); //call supplemental function $url = str_replace(parse_url(get_bloginfo('url'), PHP_URL_HOST), $hostname, $url); return $url; } function par_get_hostname($name) { $subdomains = array('media1.mydomain.com','media2.mydomain.com'); //add your subdomains here $host = abs(crc32(basename($name)) % count($subdomains)); $hostname = $subdomains[$host]; return $hostname; } add_filter('wp_get_attachment_url', 'parallelize_hostnames', 10, 2);