Skip to content

Instantly share code, notes, and snippets.

View AntoineAugusti's full-sized avatar
🚄
High speed, low carbon

Antoine Augusti AntoineAugusti

🚄
High speed, low carbon
View GitHub Profile
<?php
$PieChart = new Chart('pie', 'examplePie');
$PieChart->set('data', array(2, 10, 16, 30, 42));
$PieChart->set('legend', array('Work', 'Eat', 'Sleep', 'Listen to music', 'Code'));
$PieChart->set('displayLegend', true);
echo $PieChart->returnFullHTML();
?>
@AntoineAugusti
AntoineAugusti / gist:6200354
Created August 10, 2013 13:02
Sort array of users objects, based on their name
<?php
class User
{
protected $name;
/*
Returns < 0 if $a->name is less than $b->name; > 0 if $a->name is greater than $b->name, and 0 if they are equal.
*/
static function sortUsersName(User $a, User $b)
{
//
// This function moves long emails in your Inbox to the Archive folder and warn the sender that you don't want to read too long emails.
// It could be very useful if you want to keep a clean inbox and spend less time reading and writring emails
// Just run it every 5 minutes (for example) and you'll be fine!
//
// Copyleft - Antoine AUGUSTI - www.antoine-augusti.fr - 2013
//
function filterLongEmails()
{
program triInsertion;
const MAX = 20;
var t : array[1..MAX] of integer;
var nb : integer;
type tableau = array[1..MAX] of integer;
{On recherche où placer l'élément sur l'intervalle [1..borneSup]}
function obtenirIndiceDInsertion (t : tableau; borneSup, lEntier : integer) : integer;
var i : integer;
begin
<?php
function age($naiss)
{
list($jour, $mois, $annee) = split('[/]', $naiss);
$today['mois'] = date('n');
$today['jour'] = date('j');
$today['annee'] = date('Y');
$annees = $today['annee'] - $annee;
@AntoineAugusti
AntoineAugusti / gist:4374455
Created December 25, 2012 17:56
_trackEvent, signup page
// Dans le menu
<a href="signup" onClick="_gaq.push(['_trackEvent', 'Page d\'inscription', 'Clic', 'Menu']);" title="Inscription">Inscription</a>
// Dans l'article de blog
<a href="signup" onClick="_gaq.push(['_trackEvent', 'Page d\'inscription', 'Clic', 'Article de blog']);" title="Inscription">Inscription</a>
// Dans le footer
<a href="signup" onClick="_gaq.push(['_trackEvent', 'Page d\'inscription', 'Clic', 'Footer']);" title="Inscription">Inscription</a>
@AntoineAugusti
AntoineAugusti / gist:4347250
Created December 20, 2012 17:57
Cookie for multiple subdomains
<?php
ini_set('session.cookie_domain', substr($_SERVER['SERVER_NAME'], strpos($_SERVER['SERVER_NAME'], "."), 100));
@AntoineAugusti
AntoineAugusti / gist:4293720
Created December 15, 2012 10:44
Reload configuration files for Postfix
postfix reload
# Reponse de Postfix :
#postfix/postfix-script: refreshing the Postfix mail system
postsuper -r ALL
# Exemple de reponse :
#postsuper: Requeued: 42 messages
postfix flush
#amavis unix - - - - 2 smtp
# -o smtp_data_done_timeout=1200
# -o smtp_send_xforward_command=yes
# Il faut commenter la ligne de content_filter comme ci-dessous
#content_filter = amavis:[127.0.0.1]:10024