Skip to content

Instantly share code, notes, and snippets.

@maximevalette
maximevalette / clearfix.css
Created August 16, 2012 06:54
CSS micro clearfix hack
/* For modern browsers */
.cf:before,
.cf:after {
content:"";
display:table;
}
.cf:after {
clear:both;
}
@maximevalette
maximevalette / gist:3307568
Created August 9, 2012 20:01
Supprimer .DS_Store
find . -name .DS_Store -type f -exec rm -v {} \;
@maximevalette
maximevalette / wordcut.php
Created August 9, 2012 14:31
Couper une chaîne de caractère sans casser de mot
<?php
/**
* @param $string string Chaîne de caractères à couper
* @param $max_length int Longueur maximum de la chaîne de caractère coupée
* @return string
*/
function word_cut($string, $max_length) {
if (strlen($string) <= $max_length) return $string;
@maximevalette
maximevalette / junkmail.php
Created August 3, 2012 16:11
Détecter les adresses junkmail
<?php
function junkMail($mail) {
$domains = array('pjjkp.com', 'ephemail.com', 'ephemail.org', 'ephemail.net', 'jetable.org', 'jetable.net', 'jetable.com', 'yopmail.com', 'haltospam.com', 'tempinbox.com', 'brefemail.com', '0-mail.com', 'link2mail.net', 'mailexpire.com', 'kasmail.com', 'spambox.info', 'mytrashmail.com', 'mailinator.com', 'dontreg.com', 'maileater.com', 'brefemail.com', 'yopmail.com', '0-mail.com', 'brefemail.com', 'ephemail.net', 'guerrillamail.com', 'guerrillamail.info', 'haltospam.com', 'iximail.com', 'jetable.net', 'jetable.org', 'kasmail.com', 'klassmaster.com', 'kleemail.com', 'link2mail.net', 'mailin8r.com', 'mailinator.com', 'mailinator.net', 'mailinator2.com', 'myamail.com', 'mytrashmail.com', 'nyms.net', 'shortmail.net', 'sogetthis.com', 'spambox.us', 'spamday.com', 'Spamfr.com', 'spamgourmet.com', 'spammotel.com', 'tempinbox.com', 'yopmail.com', 'yopmail.fr', 'guerrillamail.org', 'temporaryinbox.com', 'spamcorptastic.com', 'filzmail.com', 'lifebyfood.com', 'tempemail.net', 'spamfr
@maximevalette
maximevalette / gplus-importer.php
Created August 2, 2012 06:49
Import G+ vers WordPress
<?php
date_default_timezone_set('Europe/Paris');
# Mettez le bon chemin pour le fichier wp-blog-header.php de votre blog WordPress
include(dirname(__FILE__).'/../../../wp-blog-header.php');
# Par défaut le fichier gplus.last est dans le même répertoire que le script
$gplus_file = dirname(__FILE__)."/gplus.last";
$limit_date = strtotime(trim(file_get_contents($gplus_file)));
chmod 755 /System/Library/CoreServices/SystemVersion.plist
sudo vim /System/Library/CoreServices/SystemVersion.plist
@maximevalette
maximevalette / gist:1958384
Created March 2, 2012 13:32
Ajouter PD.TC aux clients Tweetdeck, Tweetbot ou Twitter pour Mac / iPhone
http://pd.tc/shorten?url=%@&api=1
@maximevalette
maximevalette / bs_eztv.php
Created February 18, 2012 16:18
Récupérer facilement ses épisodes non-vus de BetaSeries
#!/usr/bin/php5
<?php
/* Configuration */
$BS_LOGIN = ''; # Votre login BetaSeries
$BS_API_KEY = ''; # Votre clé API
$DL_FILE = dirname(__FILE__).'/torrents.list'; # Le nom du fichier où sont recensées les URL déjà téléchargées
$TMP_FILE = dirname(__FILE__).'/episode.torrent'; # Le nom du fichier temporaire où est stocké le torrent
@maximevalette
maximevalette / apache2.conf
Created February 15, 2012 10:54
Log except one referer
SetEnvIf Referer www\.baddomain\.com dontlog
CustomLog /var/log/apache2/access.log vhosts env=!dontlog
LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhosts
@maximevalette
maximevalette / gitolite.conf
Created October 13, 2011 19:39
Utiliser git avec des sites Web
repo monsite.com
RW+ = maxime stagiaire
R = stagiaire
RW+ NAME/ = maxime
R NAME/ = stagiaire
RW+ refs/heads/develop NAME/ = stagiaire