Skip to content

Instantly share code, notes, and snippets.

View francois2metz's full-sized avatar

François de Metz francois2metz

View GitHub Profile
@francois2metz
francois2metz / testcase.html
Created August 25, 2011 09:00
Testcase to show chrome bug with position fixed
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Chrome bug position fixed</title>
<style type="text/css">
.topbar {
left: 0;
position: fixed;
top: 0;
@francois2metz
francois2metz / migrator.rb
Created July 20, 2011 17:46
Migrate from drupal to jekyll
#!/usr/bin/env ruby
require 'net/http'
require 'jekyll'
def get_name(title, time)
slug = title.strip.downcase.gsub(/&#039;/, '').gsub(/&quot;/, '').gsub(/(&|&amp;)/, ' and ').gsub(/[\s\.\/\\]/, '-').gsub(/[^\w-]/, '').gsub(/[-_]{2,}/, '-').gsub(/^[-_]/, '').gsub(/[-_]$/, '')
name = time.strftime("%Y-%m-%d-") + slug + '.md'
end
(1..307).each do |node_id|
@francois2metz
francois2metz / indextank.js
Created June 13, 2011 16:48
indextank with Node and Spore
// mkdir indextank
// wget https://github.com/SPORE/api-description/blob/master/services/indextank.json
// install node and npm
// npm install spore underscore futures
// edit baseUrl, password and index var
// node indextank.js
var baseUrl = 'http://xxx.api.indextank.com';
var password = 'xxx';
var index = 'test_spore';
var base64 = require('base64');
var assert = require('assert');
function roundTrip(str) {
assert.equal(base64.decode(base64.encode(new Buffer(str, 'utf8'))), str);
}
['Hello', 'États-Unis'].forEach(roundTrip);
@francois2metz
francois2metz / source.txt
Created February 3, 2011 10:27
Add header in all source file
find src/ -name *.erl -exec sh -c "mv '{}' /tmp/plop && cp source.txt '{}' && cat /tmp/plop >> '{}' && rm /tmp/plop" \;
@francois2metz
francois2metz / tmux.conf
Created December 20, 2010 15:10 — forked from oz/tmux.conf
# General config:
# ---------------
setw -g utf8 on
set -g lock-after-time 1800
set-window-option -g automatic-rename off
set -g default-terminal screen
# Look & feel:
# ------------
# Panes colors
@francois2metz
francois2metz / github.json
Created November 25, 2010 13:18
Small part of github API described with SPORE
{
"base_url" : "http://github.com/api/v2/",
"version" : "0.4",
"methods" : {
"user_search" : {
"path" : "/:format/user/search/:search",
"method" : "GET",
"required_params" : [
"format",
"search"
var http = require('http');
var sys = require('sys');
function request()
{
var host = 'google.com';
var client = http.createClient(443, host, true);
var request = client.request('GET', '/',
{'host': host});
request.end();