Skip to content

Instantly share code, notes, and snippets.

View quoidautre's full-sized avatar

3dw4rd5n0wd3n quoidautre

  • New York
View GitHub Profile
@quoidautre
quoidautre / gist:2308791
Created April 5, 2012 07:37
JS: Fade toggle
jQuery.fn.fadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle'}, speed, easing, callback);
};
@quoidautre
quoidautre / gist:2308792
Created April 5, 2012 07:37
JS: Slide fade toggle
jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};
@quoidautre
quoidautre / gist:2308793
Created April 5, 2012 07:38
JS: Fade images
function fadeImages($item) {
// Affichage des images en fade
var items = $item.hide();
var i = 0;
(function displayImages() {
items.eq(i++).fadeIn(200, displayImages);
})();
}
@quoidautre
quoidautre / gist:2834455
Created May 30, 2012 08:01
LESSCSS : debugging
<script type="text/javascript"> less = { env: 'development' }; </script>
@quoidautre
quoidautre / gist:2987212
Created June 25, 2012 07:44
MYSQL: create new user
grant CREATE,INSERT,DELETE,UPDATE,SELECT on newdatabse.* to newuser@localhost;
update user set password = password('new password') where User='newuser';
@quoidautre
quoidautre / gist:3099547
Created July 12, 2012 17:37
MYSQL: Chercher les doublons
SELECT field, count(*)
FROM table GROUP BY field
HAVING count(*) > 1
@quoidautre
quoidautre / gist:3099615
Created July 12, 2012 17:49
PRESTASHOP: Afficher doublons des références dans la table ps_product
<?php
$requete = "select reference,count(*) AS Number from ps_product group by reference having Number > 1 ORDER BY Number desc;";
$result = mysql_query($requete,$connection); // envoi de la requête
while ($row = mysql_fetch_array($result)) {
if ($row['reference'] != '') {
echo $row['reference'].' => '.$row['Number'].' fois<br>';
}
}
@quoidautre
quoidautre / gist:3103496
Created July 13, 2012 08:00
PRESTASHOP: Infos sur le produit
private function _getInfoAboutProduct($params){
$id_product = isset($_REQUEST['id_product'])?(int)$_REQUEST['id_product']:0;
if($id_product != 0){
$id_lang = intval($params['cookie']->id_lang);
$result = Db::getInstance()->ExecuteS('
SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`,
i.`id_image`, il.`legend`, m.`name` AS manufacturer_name
@quoidautre
quoidautre / gist:3104000
Created July 13, 2012 09:56
WINDOWS: Commande "at" en mode administrateur
=> Démarrer -> exécuter -> taper "cmd" + CTRL+SHIFT+ENTREE
Exemple : at 10:00 /EVERY:l,ma,me,j,v "C:\wamp\bin\php\php.exe -f C:\wamp\www\cron\cron-cadeau-anniversaire.php"
@quoidautre
quoidautre / gist:3121303
Created July 16, 2012 07:11
MYSQL: Dates anniversaire de maintenant, à dans 4 mois (prestashop)
$nbDays = 30;
$query = '
SELECT DISTINCT c.id_customer, firstname, lastname, email
FROM '._DB_PREFIX_.'customer c
LEFT JOIN
'._DB_PREFIX_.'orders o ON (c.id_customer = o.id_customer)
WHERE