Skip to content

Instantly share code, notes, and snippets.

View ArnaudLigny's full-sized avatar
👨‍💻
Solving problems

Arnaud Ligny ArnaudLigny

👨‍💻
Solving problems
View GitHub Profile
@ArnaudLigny
ArnaudLigny / comcenter_sync.json
Last active August 29, 2015 14:05
Battlelog JSON
{"type":"success","message":"OK","data":{"friendrequests":[],"originavailable":true,"friendscomcenter":[{"username":"SaintPalpaT","gravatarMd5":"b2ecdda4053c6bfbbd455a02150e1486","userId":"2832665149459326336","createdAt":1319696078,"presence":{"userId":"2832665149459326336","updatedAt":1437696404,"presenceStates":"0"}},{"username":"sergionimo","gravatarMd5":"","userId":"2832665149463958913","createdAt":1319728891,"presence":{"userId":"2832665149463958913","updatedAt":1437691217,"presenceStates":"0"}},{"username":"zephobosky","gravatarMd5":"ecfe1425f1c1b2660bdeff5c2660c0a2","userId":"2832665149453052163","createdAt":1319628438,"presence":{"userId":"2832665149453052163","updatedAt":1437696646,"presenceStates":"0"}},{"username":"SytrY_SG","gravatarMd5":"742404f2120482d523d940de47086f3e","userId":"2832665149440809734","createdAt":1319483042,"presence":{"userId":"2832665149440809734","updatedAt":1437695055,"presenceStates":"0"}},{"username":"nouguifred","gravatarMd5":"7a0c01f0541c03b46f8b84a220bc97a7","userId":"2
@ArnaudLigny
ArnaudLigny / Marie et moi
Created January 23, 2012 14:23
Echange rapide entre Marie (conseillère Bouygues Telecom) et moi (début 2011)
Marie: Bonjour, je suis un conseiller Bouygues Telecom. Avez-vous des questions sur nos offres et téléphones mobiles ?
Marie: Veuillez saisir votre question ci-dessous
Vous: Bonjour Marie, je suis client BT et j'aimerai remplacer mon HTC Desire par un Nexus S, je peux profiter du code de remise de XXXx ?
Marie: Bonjour.
Marie: J'ai bien lu votre question concernant le changement de mobile pour le remboursement.
Marie: Déplaçons la fenêtre de chat en bas de votre écran. Ainsi, vous pourrez naviguer sur notre site tout en chattant. Veuillez cliquer sur « Oui » pour la déplacer.
Marie: Je vous remercie.
Marie: Quel forfait avez-vous en ce moment ?
Vous: Neo 3
Marie: Est-ce pour un nouveau forfait et un nouveau numéro ?
@ArnaudLigny
ArnaudLigny / Battlelog_Servers_List.php
Created January 25, 2012 17:44
PHP script (that uses ZF) returns your latest Battlelog servers list as array
<?php
/**
* PHP script (that uses ZF) returns your latest Battlelog servers list as array
*
* @author Arnaud Ligny aka Narno <arnaud@ligny.org>
*/
define('DS', DIRECTORY_SEPARATOR);
define('PS', PATH_SEPARATOR);
define('BP', dirname(dirname(dirname(dirname(__FILE__))))); // ../../../ change it if necessary
@ArnaudLigny
ArnaudLigny / Narno_Gettext_Model_Translate.php
Last active September 29, 2015 23:47
Use Gettext to translate Magento modules
<?php
/**
* Narno Gettext Translate model
* (overlap of Mage_Core_Model_Translate)
*
* Support Gettext file (binary).
*/
class Narno_Gettext_Model_Translate extends Mage_Core_Model_Translate
{
[...]
@ArnaudLigny
ArnaudLigny / Varien_Simplexml_Config.php
Created January 27, 2012 09:38
Check the XML validity of Magento configuration files
<?php
/**
* Varien_Simplexml_Config overlap to Check the XML validity
* of Magento configuration files
*/
class Varien_Simplexml_Config {
[...]
/**
* Imports XML file
<?php
// category source
$category_id = '3';
$category = Mage::getModel('catalog/category')->load($category_id);
$category_products = $category->getProductsPosition();
// clone category
$category_copy = clone $category;
$category_copy
->setId(null)
@ArnaudLigny
ArnaudLigny / dayz-version.php
Last active October 13, 2015 08:58
Print last version number and date of the DayZ Mod, as JSON format.
<?php
$htmlPage = 'http://dayzmod.com/?Download'; // page to parse
$versionXPathQuery = '/html/body/section/div[1]/div/div[2]/div[1]/span[2]'; // version XPath query
$dateXPathQuery = '/html/body/section/div[1]/div/div[2]/div[2]/text()'; // date XPath query
$dateOriginYear = '2013'; // hard coded
try {
$date = null;
$version = null;
@ArnaudLigny
ArnaudLigny / github_repo.html
Last active December 10, 2015 23:49
Display Github repo list with javscript in HTML page.
<div class="github-repos span-9 last">
<h4>My Github Projects</h4>
<ul>
<li>Loading...</li>
</ul>
</div>
<div class="github-org-repos span-9 last">
<h4>Baobaz Github Projects</h4>
<ul>
<li>Loading...</li>
<?php
/**
* Recursively remove a directory
*
* @param string $dirname
* @param boolean $followSymlinks
* @return boolean
*/
function RecursiveRmdir($dirname, $followSymlinks=false)
{
@ArnaudLigny
ArnaudLigny / gist:5086220
Created March 4, 2013 22:21
audio.js "Muxtape" style
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>audio.js</title>
<meta content="width=device-width, initial-scale=0.6" name="viewport">
<style>
body {
font-family: sans-serif;
line-height: 1.4;