Skip to content

Instantly share code, notes, and snippets.

View AurelienLavorel's full-sized avatar

Aurélien Lavorel AurelienLavorel

View GitHub Profile
@AurelienLavorel
AurelienLavorel / gist:7bd00f6130a88e24e447
Created June 17, 2015 19:29
DediService To Owebia Shipping
SELECT CONCAT(
(zone.`livraison_zone_poids_max`) /1000,
':',
(zone.`livraison_zone_prix`) / 1.2,
','
)
FROM `livraison_zone` AS zone
INNER JOIN livraison AS liv ON liv.livraison_id = zone.livraison_id
WHERE liv.livraison_code = "GLS"
ORDER BY zone.`livraison_zone_poids_max` ASC
@AurelienLavorel
AurelienLavorel / gist:45f521ab8496f4badfff
Last active August 29, 2015 14:23
Generate Switch Images for Magento
<?php
/**
* Generate Switch Images for Magento
* cp out/* media/wysiwyg/swatches
*/
$x = 21;
$y = 21;
$colors = array(
'Lemon yellow' => '#FFE500',
'Sunflower yellow' => '#FFAE00',
@AurelienLavorel
AurelienLavorel / datacenter_google.php
Created June 25, 2015 19:33
Use special DC for scrapping Google by LavoWeb
<?php
$dc = "173.194.44.35";
$tld = "com";
$ch = curl_init("http://" . $dc);
curl_setopt($ch, CURLOPT_HEADER, "Host: www.google." . $tld);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
@AurelienLavorel
AurelienLavorel / mapSpecialCharacters
Created August 18, 2015 14:21
mapSpecialCharacters
<?php
/**
* Map Special Characters to avoid problems with Fedex API
*
* @param string|array $input input
*
* @return string
*/
public function mapSpecialCharacters($input)
{
@AurelienLavorel
AurelienLavorel / installFailoverIp.sh
Created August 20, 2015 20:21
Add failover Debian
#!/bin/sh
display_usage() {
echo "This script must be run with super-user privileges."
echo -e "\nUsage:\n$0 ip [interface] \n"
echo -e "\nExample:\n$0 192.168.0.1 eth1 \n"
}
# if less than one argument supplied, display usage
if [ $# -le 0 ]
then
display_usage
@AurelienLavorel
AurelienLavorel / quick_import_colors.js
Created January 23, 2016 16:24
Quick import colors Magento2
var colors = ["Sky blue","Antique violet","..."];
var i = 1;
colors.each(function(color) {
console.log(color, i);
jQuery('button#add_new_option_button').click();
jQuery('td.col-option_' + i + ' > input').val(color);
i++;
});
@AurelienLavorel
AurelienLavorel / photo.txt
Last active March 1, 2016 21:02
Get files quickly
http://lavoweb.net/wp-content/themes/lavowebnet/images/logo/referencement_magento_grand.png
http://lavoweb.net/wp-content/themes/lavowebnet/images/featured-image1.png
SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN=32768;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables,'dummy') INTO @tables;
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;
@AurelienLavorel
AurelienLavorel / fancyBackground.js
Created May 15, 2016 14:27
Add fancy background
<script>
jQuery('body, html').css({
'background-image': 'url(https://source.unsplash.com/category/nature/' + jQuery(window).width() + 'x' + jQuery(window).height() + ')',
'background-size': jQuery(window).width() + 'px ' + jQuery(window).height() + 'px'
});
</script>
# Autodetect text files
* text=auto
# Force the following filetypes to have unix eols, so Windows does not break them
*.* text eol=lf
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain