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 / 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;
@ArnaudLigny
ArnaudLigny / Mage_Core_Model_Config.php
Created June 19, 2013 12:02
Override Magento to handle PHP 5.3+ namespaces.
<?php
/**
* Retrieve class name by class group
*
* @param string $groupType currently supported model, block, helper
* @param string $classId slash separated class identifier, ex. group/class
* @param string $groupRootNode optional config path for group config
* @return string
*
* @override Override to handle PHP namespaces
<?php
[...]
/**
* Redeclare custom error handler
* with Whoops support
* @see https://github.com/filp/whoops
*
* @param string $handler
* @return Mage_Core_Model_App
*/
<?php
class {Namespace}_{Module}_Model_Observer
{
public function beforeBlockToHtml(Varien_Event_Observer $observer)
{
$grid = $observer->getBlock();
/**
* Mage_Adminhtml_Block_Catalog_Product_Grid
<?php
function slugify($string) {
$string = preg_replace('/
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
@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 / README.md
Last active June 25, 2021 16:10
SensCritique : Liste des badges (1464)

How to update the list?

You need PHP 7.1+ and Composer.

  1. Download composer.phar

  2. Install the crawler

php composer.phar require "fabpot/goutte:^3.0"
@ArnaudLigny
ArnaudLigny / PhpArrayToYaml.php
Last active May 24, 2023 10:52
Convert PHP array to YAML
#!/usr/local/bin/php
<?php
if (php_sapi_name() !== 'cli') {
return;
}
date_default_timezone_set('Europe/Paris');
require_once 'vendor/autoload.php';
use Symfony\Component\Yaml\Yaml;
try {
@ArnaudLigny
ArnaudLigny / index.md
Last active November 14, 2017 01:20
gist.phpoole.org test
var casper = require("casper").create({
pageSettings: {
loadImages: false,
loadPlugins: false
}
});
var checked = [];
var currentLink = 0;
var fs = require('fs');
var upTo = ~~casper.cli.get('max-depth') || 100;