Ultraviolet qui marche mieux.

This commit is contained in:
Yann Esposito (Yogsototh) 2010-03-12 15:37:42 +01:00
parent 4a6d4c6f1c
commit 13797b1cfb
35 changed files with 284 additions and 285 deletions

View file

@ -162,12 +162,12 @@ This is why I created two simple scripts to automate this. One for creating a br
Then when you want to create a new branch (locally and remotely) ; you simply have to do a:
<div><code class="zsh">git-create-new-branch branch_name</code></div>
<code class="zsh">git-create-new-branch branch_name</code>
and when you are on another computer and want to get locally all the remote branches you execute:
<div><code class="zsh">git-get-remote-branches</code></div>
<code class="zsh">git-get-remote-branches</code>
Here are the code of theese two scripts:

View file

@ -31,17 +31,17 @@ Here is my new script, it first create a map which associate to each file its ha
Even with this script I also have some problem. Mostly due to 'webdav' issues. For example, renaming a folder work really badly (on Linux at least). I use webdavfs. For example:
<div><code class="zsh">
<code class="zsh">
mv folder folder2
</code></div>
</code>
It returns OK and I've got:
<div><code class="zsh">
<code class="zsh">
$ ls
folder folder2
</code></div>
</code>
Booh....
@ -49,7 +49,7 @@ Booh....
In order to handle most webdav issues I use a *framework* in zsh. It handle almost all except the correct renaming of folder. Working on it... Anyway here is the code I use.
<div><code class="zsh" file="webdav-framework">
<code class="zsh" file="webdav-framework">
#!/usr/bin/env zsh
function samelineprint {
@ -158,12 +158,12 @@ function trymv {
done
print
}
</code></div>
</code>
And here is the code on how I synchronize my website. There is a little cryptic code. It correspond a problem caused by the bluecloth filter which is a markdown program made in ruby. Each time my email is written it is transformed differently. This is why I remove this part from the content of each html file. Without it, all my files containing email are different at each regeneration of my website.
<div><code class="zsh" file="publish">
<code class="zsh" file="publish">
#!/usr/bin/env zsh
# Script synchronisant le site sur me.com
@ -285,7 +285,7 @@ else
print -P -- "%BSync%b[${Root:t} => ${destRep:t}$suffix]"
incrementalPublish
fi
</code></div>
</code>
This is my way to replace `rsync` with filesystem not handling it.

View file

@ -24,16 +24,16 @@ For developer IE is a nightmare. This is why, I use a method to disable my stand
<div><code class="javascript">
<code class="javascript">
$(document).ready( function() {
if ($.browser["msie"]) {
// include the ie.js file
$('head').append('<script type="text/javascript" src="/js/ie.js"></scr' + 'ipt>');
}
});
</code></div>
</code>
<div><code class="javascript" file="ie.js">
<code class="javascript" file="ie.js">
// Remove all CSS I don't want to use on IE
$('link[rel=stylesheet]').each(function(i)
{
@ -51,6 +51,6 @@ $('head').append('<link rel="stylesheet" type="text/css" href="/css/ie.css"/>');
// I also add a message on top of the page
$('body').prepend('<div id="iemessage"><p><span class="fr"><em>Avec <a href="http://www.firefox.com"> Firefox </a> et <a href="http://www.apple.com/safari">Safari</a> cette page est bien plus jolie !</em></span><span class="en"><em>This page is far nicer with <a href="http://www.firefox.com"> Firefox </a> and <a href="http://www.apple.com/safari">Safari</a>!</em></span></p>.</div>');
</code></div>
</code>
That's it.

View file

@ -48,7 +48,7 @@ The HTML:
The CSS:
<div><code class="css">
<code class="css">
#menuButton {
font-size: 2em;
height: 2em;

View file

@ -42,7 +42,7 @@ HTML:
CSS:
<div><code class="css">
<code class="css">
#entete {
top: 1em;
left: 0;
@ -56,11 +56,11 @@ CSS:
left: 0;
position: fixed;
width: 10em; }
</code></div>
</code>
Javascript:
<div><code class="javascript">
<code class="javascript">
var last=0;
// will hide the menu in 5 seconds
@ -100,7 +100,7 @@ function showMenu() {
autoHideMenu(last);
}
</code></div>
</code>
Simple and lightweight. No timer (almost), no memory leak, no Date...

View file

@ -26,7 +26,7 @@ Here is a tip, I don't know why, but I almost always forgot how to do that.
When you want to launch a command and this command should not be killed after you close your terminal. Here is how to accomplish that from command line:
<div><code class="zsh">
<code class="zsh">
nohup cmd &
</code>
<small>where <code>cmd</code> is your command.</small>

View file

@ -179,19 +179,19 @@ And I return exactly in branches Bazaar provided me.
For now, I prefer (from far) Bazaar terminology. They are cleaner and more understandable.
<div><code class="zsh">bzr revert</code></div>
<code class="zsh">bzr revert</code>
Is clearer than
<div><code class="zsh">git reset --hard HEAD</code></div>
<code class="zsh">git reset --hard HEAD</code>
We can tell the same thing about
<div><code class="zsh">bzr revert -r -3</code></div>
<code class="zsh">bzr revert -r -3</code>
which seems preferable to
<div><code class="zsh">git reset --hard HEAD~3</code></div>
<code class="zsh">git reset --hard HEAD~3</code>
Until now, it is not big business. But now, things will go worse.
@ -204,7 +204,7 @@ If we want to revert time on all the tree we use the keyword `reset`.
Now, if I want to revert time on on file. We should naturally imagine the command will be:
<div><code class="zsh">git reset --hard FILE</code></div>
<code class="zsh">git reset --hard FILE</code>
<center>**OF COURSE NOT!**</center>
@ -212,14 +212,14 @@ Now, if I want to revert time on on file. We should naturally imagine the comman
The solution is:
<div><code class="zsh">git checkout FILE</code></div>
<code class="zsh">git checkout FILE</code>
What? **`checkout`** !? Well, ok. I accept. why not?
With Bazaar it is:
<div><code class="zsh">git revert FILE</code></div>
<code class="zsh">git revert FILE</code>
What I personally found far more natural.
@ -230,13 +230,13 @@ But the command to change the current *cheap branch* is really hard to be accept
With Bazaar it is:
<div><code class="zsh">cd ../branch</code></div>
<code class="zsh">cd ../branch</code>
Well yes. With Bazaar you have to change your directory to change your branch. It needs more disk resources but it is really clear. Which is my current branch, is just a `pwd` away. For Git here is the command:
<div><code class="zsh">git checkout branch</code></div>
<code class="zsh">git checkout branch</code>
**WTF?** I believed `checkout` was the key to get a file in some state (not the entire tree).

View file

@ -37,14 +37,14 @@ Here is the list of sufficient and necessary command to use [Git][git]. There is
Get a project from the web:
<div><code class="zsh">
<code class="zsh">
git clone ssh://server/path/to/project
</code></div>
</code>
Everyday [Git][git] usage:
<div><code class="zsh">
<code class="zsh">
# get modifications from other
git pull
# read what was done
@ -66,7 +66,7 @@ git commit -a -m "Fix bug #321"
# send local modifications to other
git push
</code></div>
</code>

View file

@ -39,7 +39,7 @@ When somebody work with files without a versions system, the following happens f
When you modify a somehow critical file you don't want to loose. You copy naturally this file with another name. For example:
<div><code class="zsh">$ cp fichier_important.c fichier_important.c.bak</code></div>
<code class="zsh">$ cp fichier_important.c fichier_important.c.bak</code>
In consequence of what, the new file, play the role of *backup*. If you break everything, you can always return in the last state by overwriting your modifications.
@ -112,7 +112,7 @@ Let's begin by an example, a two person project ; Alex and Beatrice. On a file c
Cthulhu
Shubniggurath
Yogsototh
</code></div>
</code>
Say Alex is home and modify the file:
<div style="width: 10em; margin-left: auto; margin-right: auto">

View file

@ -46,117 +46,117 @@ In the first part, we saw the list of resolved problem by [Git][git]. To resume
### get others modifications
<div><code class="zsh">
<code class="zsh">
$ git pull
</code></div>
</code>
### send modifications to others
<div><code class="zsh">
<code class="zsh">
$ git push
</code></div>
</code>
or more generally
<div><code class="zsh">
<code class="zsh">
$ git pull
$ git push
</code></div>
</code>
### get back in time
#### For all tree
<div><code class="zsh">
<code class="zsh">
$ git checkout
</code></div>
</code>
<div><code class="zsh">
<code class="zsh">
$ git revert
</code></div>
</code>
revert three version before (see my `.gitconfig` file).
<div><code class="zsh">
<code class="zsh">
$ git uncommit 3
</code></div>
</code>
Undo the las merge (if something goes wrong)
<div><code class="zsh">
<code class="zsh">
$ git revertbeforemerge
</code></div>
</code>
#### For one file
<div><code class="zsh">
<code class="zsh">
$ git checkout file
$ git checkout VersionHash file
$ git checkout HEAD~3 file
</code></div>
</code>
### list differences between each version
list files being modified
<div><code class="zsh">
<code class="zsh">
$ git status
</code></div>
</code>
fr:différences entre les fichier de la dernière version et les fichiers locaux.
<div><code class="zsh">
<code class="zsh">
$ git diff
</code></div>
</code>
liste les différences entre les fichier d'une certaine version et les fichiers locaux.
<div><code class="zsh">
<code class="zsh">
$ git diff VersionHash fichier
</code></div>
</code>
### name some version to refer to them in the future
<div><code class="zsh">
<code class="zsh">
$ git tag 'toto'
</code></div>
</code>
### show historic of modifications
<div><code class="zsh">
<code class="zsh">
$ git log
$ git lg
$ git logfull
</code></div>
</code>
### en:know who did what and when::
<div><code class="zsh">
<code class="zsh">
$ git blame fichier
</code></div>
</code>
### handle conflicts
<div><code class="zsh">
<code class="zsh">
$ git conflict
</code></div>
</code>
### manage branches
To create a branch:
<div><code class="zsh">
<code class="zsh">
$ git branch branch_name
</code></div>
</code>
To change the current branch:
<div><code class="zsh">
<code class="zsh">
$ git checkout branch_name
</code></div>
</code>
[git]: http://git-scm.org "Git"

View file

@ -19,7 +19,7 @@ multiTitle:
Under Linux Ubuntu or Debian:
<div><code class="zsh">$ sudo apt-get install git</code></div>
<code class="zsh">$ sudo apt-get install git</code>
Under Mac OS X:
@ -27,18 +27,18 @@ Under Mac OS X:
* install [MacPorts](http://macports.org/install.php)
* install [Git][git]
<div><code class="zsh">
<code class="zsh">
$ sudo port selfupdate
$ sudo port install git-core
</code></div>
</code>
## Global configuration
Save the following file as your `~/.gitconfig`.
<div><code class="zsh" file="gitconfig">
<code class="zsh" file="gitconfig">
[color]
branch = auto
diff = auto
@ -59,17 +59,17 @@ Save the following file as your `~/.gitconfig`.
# conflict = !gitx --left-right HEAD...MERGE_HEAD
[branch]
autosetupmerge = true
</code></div>
</code>
You can achieve the same result using for each entry the command: `git config --global`. Next, configure your name and your email. For example, if your name is John Doe and your email is `john.doe@email.com`. Launch the following commands:
<div><code class="zsh">
<code class="zsh">
$ git config --global user.name John Doe
$ git config --global user.email john.doe@email.com
</code></div>
</code>
Here it is. Base configuration is over. The file containing alias will help to type shorter commands.
@ -81,31 +81,31 @@ Here it is. Base configuration is over. The file containing alias will help to t
If a project is already versionned with [Git][git] you should have an `URL` of the sources. Then use the following command:
<div><code class="zsh">
<code class="zsh">
$ cd ~/Projets
$ git clone git://main.server/path/to/file
</code></div>
</code>
If there is no git server but you've got an `ssh` access. Just replace the `git://host` by `ssh://user@host`. In order not to type your password each time, use:
<div><code class="zsh">
<code class="zsh">
$ ssh-keygen -t rsa
</code></div>
</code>
Reply to question and **do not enter* a password. Then copy your keys to the distant server. This is not the safest way to do this. The safest being, using `ssh-agent`.
<div><code class="zsh">
<code class="zsh">
me@locahost$ scp ~/.ssh/id_rsa.pub me@main.server:
me@locahost$ ssh me@main.server
password:
me@main.server$ cat id_rsa.pub >> ~/.ssh/authorized_keys
me@main.server$ rm id_rsa.pub
me@main.server$ logout
</code></div>
</code>
Now you don't need to write your password to access the `main.server`.
@ -117,40 +117,40 @@ Now you don't need to write your password to access the `main.server`.
Suppose you already have a project with files. Then it is really easy to version it.
<div><code class="zsh">
<code class="zsh">
$ cd /path/to/project
$ git init
$ git add .
$ git commit -m "Initial commit"
</code></div>
</code>
Let do a small remark. If you don't want to *version* every file. Typically intermediate compilation file, swap files... Then you need to exclude them. Just before launching the `git add .` command. You need to create a `.gitignore` file in the root directory of your project. This file will contain all exclude *pattern*. For example:
<div><code class="zsh">
<code class="zsh">
*.o
*.bak
*.swp
*~
</code></div>
</code>
Now, if you want to create a repository on a distant server, it *must* not be in `bare` mode. The repository will contain only versionning informations, but not the files of the project. To achieve that:
<div><code class="zsh">
<code class="zsh">
$ cd /path/to/local/project
$ git clone --bare . ssh://server/path/to/project
</code></div>
</code>
Others will be able to get your modifications.
<div><code class="zsh">
<code class="zsh">
git clone ssh://server/path/to/project
</code></div>
</code>
## Abstract of the second step

View file

@ -64,16 +64,16 @@ And it was so fastidious! The `git` terminology was *horrible*! And it is nothin
The first example, `checkout` is used to make only one thing from the technical point of vue. But from the user perspective, you make many *different* things with this word. Example:
<div><code class="zsh">
<code class="zsh">
git checkout pipo
</code></div>
</code>
undo the current modification of the file `pipo`
<div><code class="zsh">
<code class="zsh">
git checkout pipo
</code></div>
</code>
change the current branch to the branch `pipo`
@ -82,9 +82,9 @@ change the current branch to the branch `pipo`
And, like me, you remark, it is exactly the same command to make two completely different things. What occur when you have a `pipo` branch and a `pipo` file? By default, it change the current branch. In order to leave the ambiguity you have to use the following syntax:
<div><code class="zsh">
<code class="zsh">
git checkout ./pipo
</code></div>
</code>
Yes, hum...
@ -97,25 +97,25 @@ It works, but it is clearly not really user friendly. Furthermore, checkout had
Bazaar terminology is far more natural, because there is no command to change the current branch as there is only one branch per directory. Changing a branch in Bazaar is changing the current directory. I also believe it is the biggest problem of Bazaar, I'll tell you why. And to undo things in Bazaar:
<div><code class="zsh">
<code class="zsh">
bzr revert pipo
</code></div>
</code>
Furthermore, most Bazaar command take a revision number in parameter. For example, to get back 3 versions earlier, it is enough to write:
<div><code class="zsh">
<code class="zsh">
bzr revert -r -3 pipo
</code></div>
</code>
The `git` equivalent is far more cryptic:
<div><code class="zsh">
<code class="zsh">
bzr checkout HEAD~3 pipo
</code></div>
</code>
One more time, Bazaar is far more readable.
@ -126,37 +126,37 @@ Back in time for all the project:
with Bazaar:
<div><code class="zsh">
<code class="zsh">
bzr revert -r -3 pipo
</code></div>
</code>
and with `git`? `git checkout`? Of course not! It would be too simple. What we find in the documentation (`man`) and everywhere on the net:
<div><code class="zsh">
<code class="zsh">
git reset --hard HEAD~3
</code></div>
</code>
Except that this command is horrible. It forget revisions! Then you must use it with prudence. And you cannot tell other people working on the project you discard some changes. If someone had pulled the *bad* version, you are *doomed*. This is why you can also use:
<div><code class="zsh">
<code class="zsh">
git checkout HEAD~3 -- . && git commit -m 'back in time'
</code></div>
</code>
Just to keep a backup branch. Without it we can definitively loose the current version HEAD. But some error may rest when there were some addition and deletion of files. *The unique way to be really clean without any risk is to use the following command:*
<div><code class="zsh">
<code class="zsh">
for i in $(seq 0 2); do
git revert -n --no-edit head~$i;
done
git commit -m "reverted 3 versions back"
</code></div>
</code>
@ -170,10 +170,10 @@ The rule is simple: *NEVER use the `git reset` command on a version somebody els
It was said. Discover the best method took me some time. I'd made many different tries. The safer and best way of reverting back your tree is to use this method. If you want to make it automatic just had the following alias in your `~/.gitconfig`. Of course this alias will work only on environment having `zsh` installed. Which is the cas for most UNIX (Ubuntu, Mac OS X...).
<div><code class="zsh" file="gitconfig">
<code class="zsh" file="gitconfig">
[alias]
uncommit = !zsh -c '"if (($0)); then nb=$(( $0 - 1 )); else nb=0; fi; i=0; while ((i<=nb)); do git revert -n --no-edit HEAD~$i; ((i++)); done; git commit -m \"revert to $0 version(s) back\""'
</code></div>
</code>
# What make `git` by far the best DCVS today
@ -188,7 +188,7 @@ After talking about the negatives points of `git`, now it's time to speak about
You always work into the same main directory. For example, you can work on two fix in the same time. Say `fix1` require you to work on `file1` and `fix2` to work on `file2`. You can work in any order on `file1` and `file2` in the `master` branch. And then go to branch `fix1`, commit `file1` into it. Then go to branch `fix2` and commit `file2` into it. And finally merge the two branches `fix1` and `fix2` into `master`.
<div><code class="zsh">
<code class="zsh">
> vim file1
> vim file2
> git br fix1
@ -200,7 +200,7 @@ You always work into the same main directory. For example, you can work on two f
> git commit master
> git merge fix1
> git merge fix2
</code></div>
</code>

View file

@ -22,6 +22,6 @@ tags:
I just found a way to change the default shell on Mac OS X. This note is mostly for me, but somebody else should find it useful. Just launch the following command:
<div><code class="zsh">
<code class="zsh">
> chsh
</code></div>
</code>

View file

@ -19,17 +19,17 @@ tags:
Sometimes you cannot simply write:
<div><code class="ruby">
<code class="ruby">
if str.match(regexp) and
not str.match(other_regexp)
do_something
</code></div>
</code>
and you have to make this behaviour with only one regular expression. The problem is the complementary of regular languages is not regular. Then, for some expression it is absolutely not impossible.
But sometimes with some simple regular expression it should be possible<sup><a href="#note1">&dagger;</a></sup>. Say you want to match everything containing the some word say `bull` but don't want to match `bullshit`. Here is a nice way to do that:
<div><code class="ruby">
<code class="ruby">
# match all string containing 'bull' (bullshit comprised)
/bull/
@ -41,7 +41,7 @@ bullshi([^t]|$)/
# another way to write it would be
/bull([^s]|$|s([^h]|$)|sh([^i]|$)|shi([^t]|$))/
</code></div>
</code>
Let look closer. In the first line the expression is:
`bull([^s]|$)`, why does the `$` is needed?
@ -54,7 +54,7 @@ Because, without it the word `bull` would be no more matched. This expression me
And this is it. I hope it could help you.
Notice this method is not always the best. For example try to write a regular expression equivalent to the following conditional expression:
<div><code class="ruby">
<code class="ruby">
# Begin with 'a': ^a
# End with 'a': c$
# Contain 'b': .*b.*
@ -63,18 +63,18 @@ if str.match(/^a.*b.*c$/) and
not str.match(/^axbxc$/)
do_something
end
</code></div>
</code>
A nice solution is:
<div><code class="ruby">
<code class="ruby">
/abc| # length 3
a.bc| # length 4
ab.c|
a[^x]b[^x]c| # length 5
a...*b.*c| # length >5
a.*b...*c/
</code></div>
</code>
This solution uses the maximal length of the string not to be matched.
There certainly exists many other methods. But the important lesson is

View file

@ -46,36 +46,36 @@ The first error is to use the *evil* `.*`. Because you will match from the first
Until now, that was, easy. Now, how do you manage when instead of `a` you have a string?
Say you want to match:
<div><code class="perl">
<code class="perl">
<li>...<li>
</code></div>
</code>
This is a bit difficult. You need to match
<div><code class="perl">
<code class="perl">
<li>[anything not containing <li>]</li>
</code></div>
</code>
The first method would be to use the same reasoning as in my [previous post](previouspost). Here is a first try:
<div><code class="perl">
<code class="perl">
<li>([^<]|<[^l]|<l[^i]|<li[^>])*</li>
</code></div>
</code>
But what about the following string:
<div><code class="perl">
<code class="perl">
<li>...<li</li>
</code></div>
</code>
That string should not match. This is why if we really want to match it correctly<sup><a href="#note1">&dagger;</a></sup> we need to add:
<div><code class="perl">
<code class="perl">
<li>([^<]|<[^l]|<l[^i]|<li[^>])*(|<|<l|<li)</li>
</code></div>
</code>
Yes a bit complicated. But what if the string I wanted to match was even longer?
Here is the algorithm way to handle this easily. You reduce the problem to the first one letter matching:
<div><code class="perl">
<code class="perl">
# transform a simple randomly choosen character
# to an unique ID
# (you should verify the identifier is REALLY unique)
@ -98,7 +98,7 @@ s/Y/<\/li>/g
# retransform the choosen character back
s/_was_x_/X/g
s/_was_y_/Y/g
</code></div>
</code>
And it works in only 9 lines for any beginning and ending string. This solution should look less *I AM THE GREAT REGEXP M45T3R, URAN00B*, but is more convenient in my humble opinion. Further more, using this last solution prove you master regexp, because you know it is difficult to manage such problems with only a regexp.

View file

@ -22,7 +22,7 @@ tags:
Strangely enough, I didn't find any built-in tool to split a file by keyword. I made one myself in `awk`. I put it here mostly for myself. But it could also helps someone else.
The following code split a file for each line containing the word `UTC`.
<div><code class="perl">
<code class="perl">
#!/usr/bin/env awk
BEGIN{i=0;}
/UTC/ {
@ -30,7 +30,7 @@ BEGIN{i=0;}
FIC=sprintf("fic.%03d",i);
}
{print $0>>FIC}
</code></div>
</code>
In my real world example, I wanted one file per day, each line containing UTC being in the following format:
@ -40,7 +40,7 @@ Mon Dec 7 10:32:30 UTC 2009
I then finished with the following code:
<div><code class="perl">
<code class="perl">
#!/usr/bin/env awk
BEGIN{i=0;}
/UTC/ {
@ -52,4 +52,4 @@ BEGIN{i=0;}
}
}
{print $0>>FIC}
</code></div>
</code>

View file

@ -29,7 +29,7 @@ I choosen webrick)
Here an example of a very minimal HTTP Server. When it receives
a GET request at the port number 2000 at the directory '/' it returns:
<div><code class="html"><html>Content</html></code></div>
<code class="html"><html>Content</html></code>
Here is the code:

View file

@ -164,14 +164,14 @@ C'est pourquoi j'ai créé deux simples scripts pour automatiser cette opératio
Ainsi, lorsque je veux créer une nouvelle branche (localement et ligne) ; je lance le script :
<div><code class="zsh">git-create-new-branch branch_name</code></div>
<code class="zsh">git-create-new-branch branch_name</code>
et quand je suis sur un autre ordinateur et que je veux récupérer les branches crées sur un autre poste, j'exécute :
<div><code class="zsh">git-get-remote-branches</code></div>
<code class="zsh">git-get-remote-branches</code>
Voici le code des deux script (en zsh) :

View file

@ -33,17 +33,17 @@ Voici mon script, il créé tout d'abord un fichier qui contient la liste des fi
Cependant même avec ce script j'ai encore des problèmes. Dû à webdav. En particulier le renommage de répertoire. Par exemple :
<div><code class="zsh">
<code class="zsh">
mv folder folder2
</code></div>
</code>
Retourne OK et pourtant :
<div><code class="zsh">
<code class="zsh">
$ ls
folder folder2
</code></div>
</code>
Bouuhh...
@ -52,7 +52,7 @@ Bouuhh...
Pour résoudre ce type de problèmes j'utilise un *framework* en zsh. Il résout presque tous les problèmes liés à webdav à l'exception du renommage de répertoire.
<div><code class="zsh" file="webdav-framework">
<code class="zsh" file="webdav-framework">
#!/usr/bin/env zsh
function samelineprint {
@ -161,13 +161,13 @@ function trymv {
done
print
}
</code></div>
</code>
Et voici le code qui me permet de synchroniser mon site web. Il y a une partie un peu incompréhensible. C'est pour enlever les mail réencodés par le filtre bluecloth qui est une implémentation de markdown. Mes mails, sont encodés à chaque fois de façon différente à chaque réengendrement de page html. C'est pourquoi je les enlève pour ne pas les *uploadés* inutilement à chaque fois.
<div><code class="zsh" file="publish">
<code class="zsh" file="publish">
#!/usr/bin/env zsh
# Script synchronisant le site sur me.com
@ -289,7 +289,7 @@ else
print -P -- "%BSync%b[${Root:t} => ${destRep:t}$suffix]"
incrementalPublish
fi
</code></div>
</code>
C'est ma façon de remplacer `rsync` avec des filesystem qui ne permettent pas de l'utiliser. J'espère que ça pourra vous être utile. Je serai heureux de savoir si quelqu'un à une idée sur comment gérer le problème de renommage de répertoire avec webdav.

View file

@ -24,16 +24,16 @@ tags:
Pour les développeur de site web Internet Explorer est un cauchemar. C'est pourquoi j'utilise un style complètement différent pour ce navigateur. Avec la librairie jQuery.
<div><code class="javascript">
<code class="javascript">
$(document).ready( function() {
if ($.browser["msie"]) {
// include the ie.js file
$('head').append('<script type="text/javascript" src="/js/ie.js"></scr' + 'ipt>');
}
});
</code></div>
</code>
<div><code class="javascript" file="ie.js">
<code class="javascript" file="ie.js">
// Remove all CSS I don't want to use on IE
$('link[rel=stylesheet]').each(function(i)
{
@ -51,6 +51,6 @@ $('head').append('<link rel="stylesheet" type="text/css" href="/css/ie.css"/>');
// I also add a message on top of the page
$('body').prepend('<div id="iemessage"><p><span class="fr"><em>Avec <a href="http://www.firefox.com"> Firefox </a> et <a href="http://www.apple.com/safari">Safari</a> cette page est bien plus jolie !</em></span><span class="en"><em>This page is far nicer with <a href="http://www.firefox.com"> Firefox </a> and <a href="http://www.apple.com/safari">Safari</a>!</em></span></p>.</div>');
</code></div>
</code>
Voilà.

View file

@ -50,7 +50,7 @@ L'HTML :
La CSS :
<div><code class="css">
<code class="css">
#menuButton {
font-size: 2em;
height: 2em;

View file

@ -43,7 +43,7 @@ HTML :
CSS :
<div><code class="css">
<code class="css">
#entete {
top: 1em;
left: 0;
@ -57,11 +57,11 @@ CSS :
left: 0;
position: fixed;
width: 10em; }
</code></div>
</code>
Javascript :
<div><code class="javascript">
<code class="javascript">
var last=0;
// will hide the menu in 5 seconds
@ -101,7 +101,7 @@ function showMenu() {
autoHideMenu(last);
}
</code></div>
</code>
Simple et peu gourmand en ressources. Pas de timer (ou presque), pas de fuite de mémoire, pas d'utilisation de date...

View file

@ -26,7 +26,7 @@ Une petite astuce dont je ne me souvient jamais (je ne sais pas pourquoi).
Lorsque que vous souhaitez lancer une commande qui ne soit pas tuée après la fermeture du terminal voici comment s'y prendre :
<div><code class="zsh">
<code class="zsh">
nohup cmd &
</code>
<small><code>cmd</code> est la commande que vous souhaitez lancer.</small>

View file

@ -173,19 +173,19 @@ Mais dans ce cas-là, je n'ai qu'à utiliser des *clônes* et pas des *branches
Je trouve toujours que les terminologies de bazaar sont plus claires et plus concises.
<div><code class="zsh">bzr revert</code></div>
<code class="zsh">bzr revert</code>
est quand même plus clair que
<div><code class="zsh">git reset --hard HEAD</code></div>
<code class="zsh">git reset --hard HEAD</code>
De la même façon
<div><code class="zsh">bzr revert -r -3</code></div>
<code class="zsh">bzr revert -r -3</code>
je trouve ça mieux que
<div><code class="zsh">git reset --hard HEAD~3</code></div>
<code class="zsh">git reset --hard HEAD~3</code>
Là ça va commencer à se compliquer. Si on veut revenir dans le temps sur toute l'arborescence, avec Git on utilise `reset`.
@ -195,20 +195,20 @@ Là ça va commencer à se compliquer. Si on veut revenir dans le temps sur tout
Maintenant si je veux revenir dans le temps sur un seul fichier. Naturellement on se dit :
<div><code class="zsh">git reset --hard FILE</code></div>
<code class="zsh">git reset --hard FILE</code>
<center>**ET BIEN NON !**</center>
La solution c'est :
<div><code class="zsh">git checkout FILE</code></div>
<code class="zsh">git checkout FILE</code>
Quoi ? **`checkout`** !? Bon, d'accord, j'accepte, pourquoi pas après tout ?
En plus quand on est habitué à Bazaar c'est :
<div><code class="zsh">git revert FILE</code></div>
<code class="zsh">git revert FILE</code>
Ce que je trouve quand même bien plus naturel.
@ -217,12 +217,12 @@ Mais là où ça devient vraiment difficile de s'y faire c'est pour changer de b
Avec Bazaar ça donne :
<div><code class="zsh">cd ../branch</code></div>
<code class="zsh">cd ../branch</code>
Bon ok, il faut changer de répertoire, un répertoire par branche. Ça consomme de l'espace disque mais au moins on voit où on est. Avec Git voilà comment on change de branche (*branche légère*) :
<div><code class="zsh">git checkout branch</code></div>
<code class="zsh">git checkout branch</code>
Alors là, on se dit "<abbr title="What the Fuck?">WTF?</abbr>" ; en français : mais qu'est-ce que c'est que ça ? Je croyais que `checkout` c'était pour récupérer l'état d'un fichier ?

View file

@ -36,14 +36,14 @@ Voici la liste des commandes nécessaires et suffisantes pour utiliser [Git][git
Récupérer un projet :
<div><code class="zsh">
<code class="zsh">
git clone ssh://server/path/to/project
</code></div>
</code>
Utiliser [Git][git] tous les jours :
<div><code class="zsh">
<code class="zsh">
# get modifications from other
git pull
# read what was done
@ -65,7 +65,7 @@ git commit -a -m "Fix bug #321"
# send local modifications to other
git push
</code></div>
</code>
Cet article est écrit pour ceux qui en savent très peu sur les systèmes de version. Il est aussi écrit pour ceux qui n'ont pas suivi les progrès accomplis depuis CVS ou subversion (SVN). C'est pourquoi dans un premier temps j'explique rapidement quel sont le buts poursuivis par les systèmes de versions. J'explique ensuite comment installer et configurer [Git][git]. Puis, pour chaque action que doivent accomplir les <abbr title="Decentralized Concurent Versions System">DCVS</abbr> je donne les commandes [Git][git] qui y correspondent.

View file

@ -39,7 +39,7 @@ Lorsqu'on modifie un fichier un peu critique et qu'on a pas envie de perdre, on
<div><code class="zsh">$ cp fichier_important.c fichier_important.c.bak</code></div>
<code class="zsh">$ cp fichier_important.c fichier_important.c.bak</code>
Du coups, ce nouveau fichier joue le rôle de *backup*. Si on casse tout, on peut toujours écraser les modifications que nous avons faites. Évidemment le problème avec cette façon de faire c'est que ce n'est pas très professionnel. Et puis c'est un peu limité. Si on veut faire trois ou quatre modifications on se retrouve avec plein de fichiers. Parfois avec des nom bizarres comme :
@ -110,7 +110,7 @@ Sur un fichier contenant un liste de dieux *Lovecraftiens* :
Cthulhu
Shubniggurath
Yogsototh
</code></div>
</code>
Disons que Alex est chez lui, il modifie le fichier :

View file

@ -46,118 +46,118 @@ Dans la première partie, nous avons vu la liste des problèmes résolus par [Gi
### récupérer les modifications des autres
<div><code class="zsh">
<code class="zsh">
$ git pull
</code></div>
</code>
### envoyer ses modifications aux autres
<div><code class="zsh">
<code class="zsh">
$ git push
</code></div>
</code>
ou plus généralement
<div><code class="zsh">
<code class="zsh">
$ git pull
$ git push
</code></div>
</code>
### revenir dans le temps
#### Pour toute l'arborescence
<div><code class="zsh">
<code class="zsh">
$ git checkout
</code></div>
</code>
<div><code class="zsh">
<code class="zsh">
$ git revert
</code></div>
</code>
revenir trois versions en arrière
<div><code class="zsh">
<code class="zsh">
$ git uncommit 3
</code></div>
</code>
Revenir avant le dernier merge (s'il s'est mal passé).
<div><code class="zsh">
<code class="zsh">
$ git revertbeforemerge
</code></div>
</code>
#### Pour un seul fichier
<div><code class="zsh">
<code class="zsh">
$ git checkout file
$ git checkout VersionHash file
$ git checkout HEAD~3 file
</code></div>
</code>
### lister les différences entre chaque version
liste les fichier en cours de modifications
<div><code class="zsh">
<code class="zsh">
$ git status
</code></div>
</code>
fr:différences entre les fichier de la dernière version et les fichiers locaux.
<div><code class="zsh">
<code class="zsh">
$ git diff
</code></div>
</code>
liste les différences entre les fichier d'une certaine version et les fichiers locaux.
<div><code class="zsh">
<code class="zsh">
$ git diff VersionHash fichier
</code></div>
</code>
### nommer certaines versions pour s'y référer facilement
<div><code class="zsh">
<code class="zsh">
$ git tag 'toto'
</code></div>
</code>
### afficher l'historique des modifications
<div><code class="zsh">
<code class="zsh">
$ git log
$ git lg
$ git logfull
</code></div>
</code>
### savoir qui a fait quoi et quanden:know who did what and when::
<div><code class="zsh">
<code class="zsh">
$ git blame fichier
</code></div>
</code>
### gérer des conflits
<div><code class="zsh">
<code class="zsh">
$ git conflict
</code></div>
</code>
### manipuler facilement des branches
Pour créer une branche :
<div><code class="zsh">
<code class="zsh">
$ git branch branch_name
</code></div>
</code>
Pour changer de branche courante :
<div><code class="zsh">
<code class="zsh">
$ git checkout branch_name
</code></div>
</code>
[git]: http://git-scm.org "Git"

View file

@ -19,7 +19,7 @@ multiTitle:
Sous Linux Ubuntu ou Debian :
<div><code class="zsh">$ sudo apt-get install git</code></div>
<code class="zsh">$ sudo apt-get install git</code>
Sous Mac OS X :
@ -27,18 +27,18 @@ Sous Mac OS X :
* installez [MacPorts](http://macports.org/install.php)
* installez [Git][git]
<div><code class="zsh">
<code class="zsh">
$ sudo port selfupdate
$ sudo port install git-core
</code></div>
</code>
## Configuration globale
Enregistrez le fichier suivant comme le fichier `~/.gitconfig`.
<div><code class="zsh" file="gitconfig">
<code class="zsh" file="gitconfig">
[color]
branch = auto
diff = auto
@ -59,18 +59,18 @@ Enregistrez le fichier suivant comme le fichier `~/.gitconfig`.
# conflict = !gitx --left-right HEAD...MERGE_HEAD
[branch]
autosetupmerge = true
</code></div>
</code>
Vous pouvez obtenir le même résultat en utilisant pour chaque entrée la commande `git config --global`.
Configurez ensuite votre nom et votre email. Par exemple si vous vous appelez John Doe et que votre email est `john.doe@email.com`. Lancez les commandes suivantes :
<div><code class="zsh">
<code class="zsh">
$ git config --global user.name John Doe
$ git config --global user.email john.doe@email.com
</code></div>
</code>
Voilà, la configuration de base est terminée. J'ai créé dans le fichier de configuration global des *alias* qui vont permettre de taper des commandes un peu plus courtes.
@ -80,29 +80,29 @@ Voilà, la configuration de base est terminée. J'ai créé dans le fichier de c
Si un projet est déjà versionné avec [Git][git] vous devez avoir une `URL` pointant vers les sources du projet. La commande a exécuter est alors très simple.
<div><code class="zsh">
<code class="zsh">
$ cd ~/Projets
$ git clone git://main.server/path/to/file
</code></div>
</code>
S'il n'y a pas de serveur git sur le serveur distant, mais que vous avez un accès `ssh`, il suffit de remplacer le `git` de l'url par `ssh`. Pour ne pas avoir à entrer votre mot de passe à chaque fois le plus simple est de procéder comme suit :
<div><code class="zsh">
<code class="zsh">
$ ssh-keygen -t rsa
</code></div>
</code>
Répondez aux question et n'entrez **surtout PAS** de mot de passe. Ensuite copiez les clés sur le serveur distant. Ce n'est pas la façon la plus sûre de procéder. L'idéal étant d'écrire quand même un mot de passe et d'utiliser `ssh-agent`.
<div><code class="zsh">
<code class="zsh">
me@locahost$ scp ~/.ssh/id_rsa.pub me@main.server:
me@locahost$ ssh me@main.server
password:
me@main.server$ cat id_rsa.pub >> ~/.ssh/authorized_keys
me@main.server$ rm id_rsa.pub
me@main.server$ logout
</code></div>
</code>
Maintenant vous n'avez plus besoin de taper votre mot de passe pour accéder à `main.server`. Et donc aussi pour les commandes `git`.
@ -112,37 +112,37 @@ Maintenant vous n'avez plus besoin de taper votre mot de passe pour accéder à
Supposons que vous avez déjà un projet avec des fichiers. Alors il est très facile de le versionner.
<div><code class="zsh">
<code class="zsh">
$ cd /path/to/project
$ git init
$ git add .
$ git commit -m "Initial commit"
</code></div>
</code>
Une petite précision. Si vous ne souhaitez pas *versionner* tous les fichiers. Par exemple, les fichiers de compilations intermédiaires. Alors il faut les exclure. Pour cela, avant de lancer la commande `git add .`. Il faut créer un fichier `.gitignore` qui va contenir les *pattern* que git doit ignorer. Par exemple :
<div><code class="zsh">
<code class="zsh">
*.o
*.bak
*.swp
*~
</code></div>
</code>
Maintenant si vous voulez créer un repository sur un serveur distant, il faut absolument qu'il soit en mode `bare`. C'est-à-dire que le repository ne contiendra que la partie contenant les informations utile à la gestion de git, mais pas les fichiers du projet. Sans rentrer dans les détails, il suffit de lancer :
<div><code class="zsh">
<code class="zsh">
$ cd /path/to/local/project
$ git clone --bare . ssh://server/path/to/project
</code></div>
</code>
Les autres pourront alors récupérer les modifications via la commande vue précédemment :
<div><code class="zsh">
<code class="zsh">
git clone ssh://server/path/to/project
</code></div>
</code>
## Résumé de la seconde étape

View file

@ -65,16 +65,16 @@ Par exemple, `checkout` qui sert certainement à la même chose du point de vue
<div><code class="zsh">
<code class="zsh">
git checkout pipo
</code></div>
</code>
annule une modification courante du fichier `pipo`
<div><code class="zsh">
<code class="zsh">
git checkout pipo
</code></div>
</code>
change de la branche courante vers la branche `pipo`
@ -82,9 +82,9 @@ change de la branche courante vers la branche `pipo`
Et là, comme moi, vous remarquez que la même commande à deux sens complètement différents. Comment ça se passe alors, quand il y a une branche `pipo` et un fichier `pipo` alors ? Et bien par défaut, ça change de branche. Pour lever l'ambigüité il faut utiliser la syntaxe
<div><code class="zsh">
<code class="zsh">
git checkout ./pipo
</code></div>
</code>
Oui, bon... Voilà, voilà, voilà....
@ -96,24 +96,24 @@ Oui, bon... Voilà, voilà, voilà....
Là où la différence se creuse c'est avec la terminologie Bazaar qui est bien plus naturelle. Car il n'y a pas de commande pour changer de branche, puisqu'il y a une branche par répertoire. Ainsi, pour changer de branche, il suffit de faire `cd path/to/branch`. Et pour revenir en arrière :
<div><code class="zsh">
<code class="zsh">
bzr revert pipo
</code></div>
</code>
De plus, la plupart des commandes bazaar prennent en paramètre un numéro de révision, par exemple pour revenir 3 versions précédentes il suffit d'écrire :
<div><code class="zsh">
<code class="zsh">
bzr revert -r -3 pipo
</code></div>
</code>
L'équivalent sous git est beaucoup plus cryptique :
<div><code class="zsh">
<code class="zsh">
bzr checkout HEAD~3 pipo
</code></div>
</code>
Encore un fois, Bazaar est bien plus lisible.
@ -124,36 +124,36 @@ Revenir dans le temps pour tout le projet :
avec Bazaar :
<div><code class="zsh">
<code class="zsh">
bzr revert -r -3 pipo
</code></div>
</code>
et avec `git` ? `git checkout` ? Bien sûr que non voyons ! Ce serait bien trop simple. Ce que l'on trouve dans les forums c'est :
<div><code class="zsh">
<code class="zsh">
git reset --hard HEAD~3
</code></div>
</code>
Sauf que cette syntaxe est horrible. Elle oublie 'réellement' les révisions. Il faut donc l'utiliser avec prudence. Mais en effet, je conseillerai plutôt :
<div><code class="zsh">
<code class="zsh">
git checkout HEAD~3 -- . && git commit -m 'back in time'
</code></div>
</code>
Histoire d'avoir la branche backup sous la main, car sinon, on risque de perdre définitivement la version courante de HEAD. Qui ramène la branche locale à ce point. Mais il reste des erreur s'il y a eu des ajouts de fichier entre temps. *Le seul et l'unique vraiment propre de revenir en arrière dans git c'est de lancer la commande suivante :*
<div><code class="zsh">
<code class="zsh">
for i in $(seq 0 2); do
git revert -n --no-edit head~$i;
done
git commit -m "reverted 3 versions back"
</code></div>
</code>
ce qui signifie sur un système `UNIX` en `zsh` (ou `bash`) faire `git revert` de toutes les dernières versions. Même si quelqu'un d'autre à fait un pull de vos modification intermédiaire il ne sera pas embêté et il sera au courant de ce qu'il s'est passé.
@ -166,10 +166,10 @@ La règle est simple : *Ne JAMAIS utiliser la commande `git reset` avec une vers
Voilà, c'est dit. Découvrir ça m'a pris pas mal de temps, avec plein d'essai de tous les cotés. Le plus sûr reste toujours la méthode vue plus haut. Si vous souhaitez automatiser cela, le plus simple est d'ajouter l'alias suivant à votre fichier `~/.gitconfig`. Bien sûr l'alias ne fonctionnera que sur les environnement possédant `zsh`, ce qui est le cas de la plupart des environnements UNIX (Ubuntu, Mac OS X...).
<div><code class="zsh" file="gitconfig">
<code class="zsh" file="gitconfig">
[alias]
uncommit = !zsh -c '"if (($0)); then nb=$(( $0 - 1 )); else nb=0; fi; i=0; while ((i<=nb)); do git revert -n --no-edit HEAD~$i; ((i++)); done; git commit -m \"revert to $0 version(s) back\""'
</code></div>
</code>
# Ce qui fait que `git` est le meilleur DCVS jusqu'à aujourd'hui
@ -183,7 +183,7 @@ Vous travaillez toujours dans le même répertoire principal. Par exemple, vous
<div><code class="zsh">
<code class="zsh">
> vim file1
> vim file2
> git br fix1
@ -195,7 +195,7 @@ Vous travaillez toujours dans le même répertoire principal. Par exemple, vous
> git commit master
> git merge fix1
> git merge fix2
</code></div>
</code>
Et il est vraiment très agréable de ne pas se soucier d'être dans la *bonne* branche. Vous n'avez à vous occuper que de votre code et seulement ensuite vous occuper du système de version.

View file

@ -22,6 +22,6 @@ tags:
Je viens de trouver le moyen de changer son shell par défaut sous Mac OS X. Cette note est plus pour moi. Mais elle peut aussi servir à quelqu'un d'autre. Il suffit de lancer la commande :
<div><code class="zsh">
<code class="zsh">
> chsh
</code></div>
</code>

View file

@ -19,17 +19,17 @@ tags:
Sometimes you cannot simply write:
<div><code class="ruby">
<code class="ruby">
if str.match(regexp) and
not str.match(other_regexp)
do_something
</code></div>
</code>
and you have to make this behaviour with only one regular expression. The problem is the complementary of regular languages is not regular. Then, for some expression it is absolutely not impossible.
But sometimes with some simple regular expression it should be possible<sup><a href="#note1">&dagger;</a></sup>. Say you want to match everything containing the some word say `bull` but don't want to match `bullshit`. Here is a nice way to do that:
<div><code class="ruby">
<code class="ruby">
# match all string containing 'bull' (bullshit comprised)
/bull/
@ -41,7 +41,7 @@ bullshi([^t]|$)/
# another way to write it would be
/bull([^s]|$|s([^h]|$)|sh([^i]|$)|shi([^t]|$))/
</code></div>
</code>
Let look closer. In the first line the expression is:
`bull([^s]|$)`, why does the `$` is needed?
@ -54,7 +54,7 @@ Because, without it the word `bull` would be no more matched. This expression me
And this is it. I hope it could help you.
Notice this method is not always the best. For example try to write a regular expression equivalent to the following conditional expression:
<div><code class="ruby">
<code class="ruby">
# Begin with 'a': ^a
# End with 'a': c$
# Contain 'b': .*b.*
@ -63,18 +63,18 @@ if str.match(/^a.*b.*c$/) and
not str.match(/^axbxc$/)
do_something
end
</code></div>
</code>
A nice solution is:
<div><code class="ruby">
<code class="ruby">
/abc| # length 3
a.bc| # length 4
ab.c|
a[^x]b[^x]c| # length 5
a...*b.*c| # length >5
a.*b...*c/
</code></div>
</code>
This solution uses the maximal length of the string not to be matched.
There certainly exists many other methods. But the important lesson is

View file

@ -46,36 +46,36 @@ The first error is to use the *evil* `.*`. Because you will match from the first
Until now, that was, easy. Now, how do you manage when instead of `a` you have a string?
Say you want to match:
<div><code class="perl">
<code class="perl">
<li>...<li>
</code></div>
</code>
This is a bit difficult. You need to match
<div><code class="perl">
<code class="perl">
<li>[anything not containing <li>]</li>
</code></div>
</code>
The first method would be to use the same reasoning as in my [previous post](previouspost). Here is a first try:
<div><code class="perl">
<code class="perl">
<li>([^<]|<[^l]|<l[^i]|<li[^>])*</li>
</code></div>
</code>
But what about the following string:
<div><code class="perl">
<code class="perl">
<li>...<li</li>
</code></div>
</code>
That string should not match. This is why if we really want to match it correctly<sup><a href="#note1">&dagger;</a></sup> we need to add:
<div><code class="perl">
<code class="perl">
<li>([^<]|<[^l]|<l[^i]|<li[^>])*(|<|<l|<li)</li>
</code></div>
</code>
Yes a bit complicated. But what if the string I wanted to match was even longer?
Here is the algorithm way to handle this easily. You reduce the problem to the first one letter matching:
<div><code class="perl">
<code class="perl">
# transform a simple randomly choosen character
# to an unique ID
# (you should verify the identifier is REALLY unique)
@ -98,7 +98,7 @@ s/Y/<\/li>/g
# retransform the choosen character back
s/_was_x_/X/g
s/_was_y_/Y/g
</code></div>
</code>
And it works in only 9 lines for any beginning and ending string. This solution should look less *I AM THE GREAT REGEXP M45T3R, URAN00B*, but is more convenient in my humble opinion. Further more, using this last solution prove you master regexp, because you know it is difficult to manage such problems with only a regexp.

View file

@ -22,7 +22,7 @@ tags:
Strangely enough, I didn't find any built-in tool to split a file by keyword. I made one myself in `awk`. I put it here mostly for myself. But it could also helps someone else.
The following code split a file for each line containing the word `UTC`.
<div><code class="perl">
<code class="perl">
#!/usr/bin/env awk
BEGIN{i=0;}
/UTC/ {
@ -30,7 +30,7 @@ BEGIN{i=0;}
FIC=sprintf("fic.%03d",i);
}
{print $0>>FIC}
</code></div>
</code>
In my real world example, I wanted one file per day, each line containing UTC being in the following format:
@ -40,7 +40,7 @@ Mon Dec 7 10:32:30 UTC 2009
I then finished with the following code:
<div><code class="perl">
<code class="perl">
#!/usr/bin/env awk
BEGIN{i=0;}
/UTC/ {
@ -52,4 +52,4 @@ BEGIN{i=0;}
}
}
{print $0>>FIC}
</code></div>
</code>

View file

@ -29,7 +29,7 @@ I choosen webrick)
Here an example of a very minimal HTTP Server. When it receives
a GET request at the port number 2000 at the directory '/' it returns:
<div><code class="html"><html>Content</html></code></div>
<code class="html"><html>Content</html></code>
Here is the code:

View file

@ -4,7 +4,7 @@ class UltraVioletFilter < Nanoc3::Filter
require 'rio'
require 'rubygems'
require 'uv'
code_rule = %r{(<code class="(.+?)"( file="(.+?)")?>(.+?)</code>)}m
code_rule = %r{(<code class="([^"]+?)"( file="([^"]+?)")?>(.+?)</code>)}m
content.gsub!(code_rule) do |full|
# original, lang, filename, code = full[0], full[1], full[3], full[4]
original, lang, filename, code = $1, $2, $4, $5
@ -19,7 +19,7 @@ class UltraVioletFilter < Nanoc3::Filter
code_path = [ 'output' , webpath, 'code']
url = webpath + 'code/' + filename
if (url == @url)
puts %{erreur de redo : #{url}}
puts %{# erreur de redo : #{url}}
break
end
@url=url
@ -38,6 +38,5 @@ class UltraVioletFilter < Nanoc3::Filter
dest_rio = rio(dir).mkpath
frio = rio(dir, fname).delete
frio << str
puts "\t\twrote file #{dir}/#{fname}"
end
end