Project

General

Profile

SnipPets » History » Version 3

Simon, 06/02/2010 06:45 PM

1 1 Simon
= Snippets = 
2
3
== Remove trailing whitespaces ==
4
5
http://jimbojw.com/wiki/index.php?title=How_to_find_PHP_files_with_trailing_whitespace
6
7
'''Command Line :''' 
8
{{{
9
echo '<?php foreach (glob("**/*.php") as $file){if (preg_match( "/\\?".">\\s\\s+\\Z/m", file_get_contents($file))) echo("$file\n");} ?>' | php
10
}}}
11
12
13
'''PHP file script :'''
14
{{{
15
<?php
16
foreach (glob('**/*.php') as $file){
17
  if (preg_match('/\\?'.'>\\s\\s+\\Z/m',file_get_contents($file)))
18
    echo("$file\n");
19
}
20
?>
21
}}}
22 2 Simon
23
24 3 Simon
== Remove .svn folders under Windows ==
25 2 Simon
26
{{{
27
for /r repository %f in (.svn) do rd /S /Q "%f"
28
}}}
29
30 1 Simon
from : http://www.jonathan-petitcolas.com/fr/supprimer-recursivement-les-dossiers-svn-sous-windows/
31 3 Simon
32
== Ignore specific subfolders in .htaccess (URL rewrite) == 
33
34
35
'''Method 1 :'''
36
{{{
37
  RewriteEngine on
38
  #
39
  # stuff to let through (ignore)
40
  RewriteCond %{REQUEST_URI} "/folder1/" [OR]
41
  RewriteCond %{REQUEST_URI} "/folder2/"
42
  RewriteRule (.*) $1 [L]
43
  #
44
}}}
45
46
'''Method 2 :'''
47
{{{
48
RewriteEngine On
49
RewriteBase /
50
Rewritecond  %{REQUEST_URI} !^/linea21/.*$ [NC]
51
RewriteCond %{REQUEST_FILENAME} !-f
52
RewriteCond %{REQUEST_FILENAME} !-d
53
RewriteRule . /index.php [L]
54
}}}
55
56
(Ignore rules for ''linea21'' sub-folder)