Skip to content

Instantly share code, notes, and snippets.

@maximevalette
maximevalette / gist:3307568
Created August 9, 2012 20:01
Supprimer .DS_Store
find . -name .DS_Store -type f -exec rm -v {} \;
@maximevalette
maximevalette / retina.css
Created August 24, 2012 06:07
Capturer les écrans Retina avec une media query
@media
only screen and (-webkit-min-device-pixel-ratio: 1.3),
only screen and (min-device-pixel-ratio: 1.3),
only screen and (min-resolution: 120dpi) {
/* Votre code ici pour les écrans Retina */
}
@maximevalette
maximevalette / OVH_Keystone_v3.md
Last active June 28, 2022 11:56
Sample PHP script to use Keystone v3 with OVH credentials (username + password)

OVH + PHP + Keystone v3

Install PHP OpenCloud

composer require php-opencloud/openstack ^3.0

Sample token authentication with OVH credentials

<?php
@maximevalette
maximevalette / bench.php
Created October 3, 2011 11:50
Utilisation pratique de gettext avec PHP
<?php
session_start();
$locale = "fr_FR";
putenv("LC_ALL=".$locale);
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
textdomain("messages");
@maximevalette
maximevalette / episode-details.html
Last active August 18, 2017 12:14
Bouton JS BetaSeries
<script src="https://www.betaseries.com/js/button.js" async></script>
<p><a href="https://www.betaseries.com" class="betaseries-button"
data-type="episode-details"
data-show="Desperate Housewives"
data-season="1"
data-episode="6"
>Voir la fiche épisode sur BetaSeries</a></p>
@maximevalette
maximevalette / call.pl
Created January 30, 2011 10:39
SIP Call in Perl
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long qw(:config posix_default bundling);
use Net::SIP;
#Usage
sub usage {
@maximevalette
maximevalette / feedpress.php
Created December 30, 2013 15:43
Extract FeedPress subscribers count from JSON file
<?php
function get_feedpress_subscribers($url) {
$json_string =file_get_contents($url);
$json = json_decode($json_string, true);
return ( intval( $json['graph']['datasequences'][0]['datapoints'][0]['value'] ) + intval( $json['graph']['datasequences'][1]['datapoints'][0]['value'] ) );
}
@maximevalette
maximevalette / json_merge.php
Created May 18, 2013 12:28
Merges JSON files
<?php
$source = json_decode(file_get_contents('french.json'), true);
$dest = json_decode(file_get_contents('auto_french.json'), true);
function mergeArray($source, $dest) {
foreach ($dest as $k => $v) {
if (!array_key_exists($k, $source)) {
@maximevalette
maximevalette / feedburner.js
Created April 30, 2013 12:45
Consider upgrading to Internet Explorer 6
if (!(document.getElementById)) {
alert("Your browser cannot view this feed using FeedBurner's BrowserFriendly feature.\n\nConsider upgrading to Internet Explorer 6, Firefox, or Mozilla to view this feed and options for subscribing to its content in a news reader.");
}
@maximevalette
maximevalette / .htaccess
Last active December 15, 2015 07:18
Redirection with query string
RewriteCond %{QUERY_STRING} format=rss
RewriteRule ^post /rss [R=301,L]