Skip to content

Instantly share code, notes, and snippets.

@gagarine
gagarine / my.cnf
Created August 26, 2011 09:58
/usr/local/etc/my.cnf to run Drupal on Hombrew's MySQL
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
bind-address = 127.0.0.1
port = 3306
socket = /tmp/mysql.sock
max_allowed_packet = 64M
table_cache = 4096
sort_buffer_size = 2M
@gagarine
gagarine / gist:1173424
Created August 26, 2011 13:39
xwiki search form
<form onsubmit="document.location.href=document.searchform.action+'#o%3As%3Ds%253Aresource%5Ef%3Do%253Aresource%253Do%25253Aterms%25253Ds%2525253A'+escape(escape(escape(escape((jQuery('#curriki-searchbox').val() !=='recherche')?jQuery('#curriki-searchbox').val()'')))); return false;" action="http://planete.sankore.org/xwiki/bin/view/Search/" class="search-box" name="searchform" id="searchform">
<input type="hidden" value="" name="area" class="hidden">
<input type="text" onblur="if (this.value=='') this.value='recherche'" onfocus="if (this.value=='recherche') this.value=''; else this.select()" value="recherche" class="input" name="brsqry" id="curriki-searchbox">
<button name="btn" id="searchbtn" type="submit">Aller</button>
</form>
@gagarine
gagarine / migrate_article.inc
Created August 28, 2011 23:09
Migrate class for drupal migrate module
<?php
abstract class SkCommonMigration extends Migration {
public function __construct() {
parent::__construct();
//$this->addFieldMapping('field_tags', 'tags');
}
/**
@gagarine
gagarine / bookmarklet-planete.js
Created September 6, 2011 21:06
bookmarklet for sankore
if (typeof jQuery == 'undefined') {
var jQ = document.createElement('script');
jQ.type = 'text/javascript';
jQ.onload = runthis;
jQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
document.body.appendChild(jQ);
} else {
runthis();
}
# Last modified: 2011 Oct 30
# Author: Simon Perdrisat
#### Binds
# Prefix
unbind C-b
set-option -g prefix C-a
bind a send-prefix
# Last active window
@gagarine
gagarine / myregex
Created January 3, 2012 01:36
useful regex
Some of the regex I think useful...
#That will match all blank lines except if the line is the very last line in the file.
^\s*[\r\n]+
@gagarine
gagarine / drupal_install.sh
Created February 12, 2012 18:40
install drupal in the very fast way
# Using version 4 of drush http://drush.ws/help
drush dl drupal
mv drupal-7.10 d7.dev
cd d7.dev
drush site-install standard --db-url=mysql://user:passwd@localhost/og --db-su=root --db-su-pw= --site-name=D7-Dev
@gagarine
gagarine / install_php_ngninx.sh
Created February 17, 2012 14:18
Drupal on php-fpm + nginx + apc
brew update
brew install gmp
#install Nginx
brew install nginx
# copy launch script
cp /usr/local/Cellar/nginx/1.0.12/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
#try to launch Nginx
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
@gagarine
gagarine / .htacess
Created February 20, 2012 22:53
Apache redirect according to browser language
## Tested on Drupal 7
## On frontpage redirect to /fr if the browser language start with fr
RewriteCond %{HTTP:Accept-Language} ^fr.*$ [NC]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{QUERY_STRING} !(^q\=) [NC]
RewriteRule ^(.*)$ /fr [L,R=302]
@gagarine
gagarine / gist:2019386
Created March 12, 2012 02:42
sbb / cff API
SBB / CFF API mobile
xmlfahrplan.sbb.ch 194.150.245.139
Apparently this is the same crapy API than Deutsche Bahn.
### Client: POST xmlfahrplan.sbb.ch/bin/extxml.exe
<?xml version="1.0" encoding="iso-8859-1"?>