Skip to content

Instantly share code, notes, and snippets.

@jchatard
jchatard / keycodes_qwerty.js
Created August 8, 2023 19:51
BaseKeyCodeBazecoreQwertyISO
const keycodes = [
{
code: 41,
labels: {
primary: "ESC"
}
},
{
code: 58,
labels: {
@jchatard
jchatard / countries.iso-3166-1.inc.php
Created December 14, 2011 09:59
ISO-3166-1 (ALPHA 2) countries list in french
<?php
/**
* Country list ISO-3166-1 (ALPHA 2) in french
*/
function countries() {
$countries = array(
'AF' => 'Afghanistan',
'ZA' => 'Afrique Du Sud',
'AX' => 'Åland, Îles',
// L'internaute vient de valider sa saisie et elle est valide
// Premier paramètre est le message
// Second paramètre est le nom de domaine (* nous permet de gérer tous les environnements, DEV, PREPROD et PROD)
parent.postMessage("submit", "*");
@jchatard
jchatard / deploy.rb
Created February 28, 2014 09:17
Mina configuration file for Drupal deployment
require 'mina/git'
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
# branch - Branch name to deploy. (needed by mina/git)
case ENV['to']
when 'production'
set :domain, 'www.foo.bar'
# Respond to incoming requests.
sub vcl_recv {
# Use anonymous, cached pages if all backends are down.
if (!req.backend.healthy) {
unset req.http.Cookie;
}
# Allow the backend to serve up stale content if it is responding slowly.
set req.grace = 6h;
1. Télécharger Drush & décompresser drush ;-) (le répertoire doit s'appeler 'drush')
2. Ouvrir le terminal
3. Taper : open /usr/local
4. Glisser/déposer le répertoire 'drush' dans la fenêtre finder qui vient de s'ouvrir (Taper son mot de passe quand OS X le demande)
5. Dans le terminal taper: sudo chmod u+x /usr/local/drush/drush
6. Dans le terminal taper: sudo ln -s /usr/local/drush/drush /usr/bin/drush
7. Taper son mot de passe OS X
8. Tester la commande 'drush' depuis un répertoire drupal
Utiliser PHP5 de MAMP (optionnel)
<?php
// ... autres fonctions du module
/**
* Helper function that sends commands to Varnish.
* Utilizes sockets to talk to varnish terminal.
*/
function _varnish_terminal_run($commands) {
if (!extension_loaded('sockets')) {
@jchatard
jchatard / gist:2701212
Created May 15, 2012 12:02
Flush DNS cache under Mac OS X
dscacheutil -flushcache
@jchatard
jchatard / nsnumber_formatting.m
Created February 14, 2011 09:13
Formatting numbers
NSLocale *local = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
formatter = [[NSNumberFormatter alloc] init];
[formatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[formatter setLocale:local];
[local release];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];
[formatter setAlwaysShowsDecimalSeparator:YES];
Process: My Memory [773]
Path: /Applications/My Memory.app/Contents/MacOS/My Memory
Identifier: fr.breek.My-Memory
Version: 1.0 (1)
Code Type: X86 (Native)
Parent Process: launchd [89]
Date/Time: 2011-01-05 14:50:29.751 +0100
OS Version: Mac OS X 10.6.5 (10H574)
Report Version: 6