Skip to content

Instantly share code, notes, and snippets.

View guillaumevoisin's full-sized avatar

Guillaume Voisin guillaumevoisin

  • La Fourchette
  • Nantes
View GitHub Profile
219869,4442
221049,4406
221919,2961
222501,4231
222647,3497
223785,1473
223983,2935
229281,4237
234299,2724
237097,3404
@guillaumevoisin
guillaumevoisin / php-cs-fixer-git-files
Created June 18, 2015 10:05
PHP-CS-Fixer on modified files
git diff --name-only --cached --diff-filter=ACMRTUXB | while read filename; do php-cs-fixer --level=symfony fix $filename; done;
@guillaumevoisin
guillaumevoisin / st3_settings
Last active August 29, 2015 14:11
Sublime Text Configuration
Sur Ubuntu:
Keyboard
[
{ "keys": ["ctrl+keypad_divide"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+keypad_divide"], "command": "toggle_comment", "args": { "block": true } },
]
Settings
@guillaumevoisin
guillaumevoisin / search_field_in_database
Created October 16, 2014 09:21
To get all tables with columns 'columnA' or 'ColumnB' in the database 'YourDatabase'
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('columnA','ColumnB')
AND TABLE_SCHEMA='YourDatabase';
@guillaumevoisin
guillaumevoisin / truncate_all_tables
Created October 16, 2014 09:19
Truncate all tables of a database
mysql -Nse 'show tables' DATABASE_NAME | while read table; do mysql -e "truncate table $table" DATABASE_NAME; done
@guillaumevoisin
guillaumevoisin / WordPress: get post attachments
Created August 27, 2012 08:42
WordPress: Get post attachments
// place inside loop
$args = array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
@guillaumevoisin
guillaumevoisin / gist:2888792
Created June 7, 2012 13:22
PHP: List files within a directory
if ($handle = opendir('/path/to/files')) {
echo "Directory handle: $handle\n";
echo "Entries:\n";
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
echo "$entry\n";
}
closedir($handle);
@guillaumevoisin
guillaumevoisin / gist:2777217
Created May 23, 2012 19:22 — forked from ebonical/gist:464566
CSS: Clearfix
.clear:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
@guillaumevoisin
guillaumevoisin / gist:2774824
Created May 23, 2012 11:53
CSS: Image Replacement
.ir {
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@guillaumevoisin
guillaumevoisin / gist:2774786
Created May 23, 2012 11:49
HTML: Starting Template
<!doctype html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">