Skip to content

Instantly share code, notes, and snippets.

View AmauryCarrade's full-sized avatar
🍊
I don't hate you

Amaury Carrade AmauryCarrade

🍊
I don't hate you
View GitHub Profile
#!/usr/bin/python
import sys, os;
from path import path;
from datetime import datetime;
if len(sys.argv) < 2:
print('Usage: listIds.py <configDirectory> [reportFile] [lineBreaksInReportFile] [debugLevel]');
print('');
print('reportFile: a path where the report will be stored. If it is blank, the report will be saved in a file called report, in the config directory.');
@AmauryCarrade
AmauryCarrade / getBooleanFromString.java
Last active August 29, 2015 14:06
getBooleanFromString
/**
* Returns a boolean from an entered string, or null if the string does not represent a boolean.
*
* "on", "yes", "y", "true" = true
* "off", "no", "n", "false" = false
*
* @param input the input text.
* @return true/false if the string is a boolean; null else.
*/
public Boolean getBooleanFromString(String input) {
@AmauryCarrade
AmauryCarrade / chat-zcraft.user.js
Last active September 18, 2015 17:14
Accès rapide à un mini-client IRC connecté au bon canal, depuis le forum de zCraft.
// ==UserScript==
// @name Chat intégré sur le forum
// @namespace eu.carrade.amaury.zcraft.chat
// @description Intégration d'un accès à IRC sur le forum
// @include https://forum.zcraft.fr/*
// @version 2
// @grant none
// ==/UserScript==
var chat_url = "https://kiwiirc.com/client/irc.zcraft.fr/?&theme=mini#zcraft";
<?php
use Symfony\Component\HttpFoundation\Response;
$app->get("/tools/minecraft/history", function() use($app)
{
$user = isset($_GET["user"]) ? trim($_GET["user"]) : "";
$valid = true;
$emptyHistory = false;
$data = array();
<?php
// src/Zm/UserBundle/Entity/User.php
namespace Zm\UserBundle\Entity;
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
@AmauryCarrade
AmauryCarrade / al.php
Created July 2, 2012 21:48
Session management in AL
<?php
// Session management
# Get session for an easier access
$session = $_SESSION[$settings['session']];
$datetime = new \Datetime();
# Saving current page in session history
$session['history'][] = array(
'page' => $dump->url,
<?php
// Blabla
public function ChangeLanguageAction()
{
$request = $this->get('request');
$language = $request->query->get('language');
$userManager = $this->get('fos_user.user_manager');
{% for key, val in app.sessio %}
{{ key }} => {{ val }} <br />
{% else %}
Rien à lister
{% endfor %}
{% for key, flash in app.session.get('flashes') %}
{# Affichage #}
{{ app.session.set('flashes', '') }}
{% endfor %}
{% set var = '' %}
{% if var is not null %}
<h1>It's work!</h1>
<!-- N'y voit pas de référence à une tribu. Non non. -->
{% endif %}