Skip to content

Instantly share code, notes, and snippets.

View cvergne's full-sized avatar
👨‍💻
Probably developing…

Christophe Vergne cvergne

👨‍💻
Probably developing…
View GitHub Profile
@cvergne
cvergne / gist:2301589
Created April 4, 2012 14:23
Check if date is in defined date range
$startDate = strtotime('2012-04-01');
$endDate = strtotime('2012-04-30');
$searchDate = strtotime('2012-04-18');
if ($searchDate >= $startDate && $searchDate <= $endDate) {
echo 'Notre date recherchée est bien dans la plage spécifiée.';
}
string(65) "<div>
<h1>Heading</h1>
<p>Something right here...</p>
</div>"
string(62) "<div>
<h1>Heading</h1>
<p>Something right here...</p>
</div>"
@cvergne
cvergne / freebox.login.php
Created June 29, 2013 13:07
Authentification à l'API Freebox OS en PHP
// Génération du mot de passe
$password = hash_hmac('sha1', $challenge, $app_token);
@cvergne
cvergne / freebox.rss
Last active December 20, 2015 03:09
Format qu'un flux RSS doit avoir pour être pris en charge par le module RSS de Freebox OS.
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>Downloads</title>
<link>http://www.example.com</link>
<description>List of auto-downloads</description>
<!-- <ttl>60</ttl> --> <!-- Durée (en minute) de mise en cache. Facultatif, mais empêche le raffrachissement manuel via l'API -->
<item>
<title>
Nom du téléchargement
</title>
@cvergne
cvergne / install_intl.sh
Created August 23, 2013 12:02
Install intl extension to MAMP
#!/bin/bash
# get php source code
mkdir /Applications/MAMP/bin/php/php5.4.10/include
cd /Applications/MAMP/bin/php/php5.4.10/include
wget -O php-5.4.10.tar.gz http://us.php.net/get/php-5.4.10.tar.gz/from/this/mirror
tar xzf php-5.4.10.tar.gz
@cvergne
cvergne / fixairplay.sh
Created September 6, 2013 13:13
Restart audio process when selecting airplay receiver fails and auto select back Mac speakers.
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
@cvergne
cvergne / dabblet.css
Created April 23, 2014 16:47 — forked from anonymous/dabblet.css
Untitled
body { padding:50px; background:#000; }
h1 { width:250px; font:bold 36px sans-serif; letter-spacing:-1px; color:#FFF; padding: 10px 0 10px 40px; }
.wrap {
box-shadow: -35px 0 0 5px #38bfdb, 10px 0 0 5px #38bfdb;
}
.inner {
background: #38bfdb;
position:relative;
}
@cvergne
cvergne / dabblet.css
Created April 23, 2014 16:47
Untitled
body { padding:50px; background:#000; }
h1 { width:250px; font:bold 36px sans-serif; letter-spacing:-1px; color:#FFF; padding: 10px 0 10px 40px; }
.wrap {
box-shadow: -35px 0 0 5px #38bfdb, 10px 0 0 5px #38bfdb;
}
.inner {
background: #38bfdb;
position:relative;
}
@cvergne
cvergne / itunes-play.sh
Created June 13, 2014 13:05
Avoid iTunes to launch when pressing "play" button
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist
config_files = Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf")
config_files.each do |file|
certificate_files = ['ca', 'cert', 'key', 'tls-auth']
config_dir = File.dirname(file)
connection_name = nil
new_config = []
File.read(file).each_line do |line|
line.strip!