Skip to content

Instantly share code, notes, and snippets.

@ArnaudBan
ArnaudBan / gulpfile.js
Last active Apr 20, 2016
Ma confige Gulp
View gulpfile.js
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
plumber = require('gulp-plumber');
var browserSync = require('browser-sync').create();
@ArnaudBan
ArnaudBan / admin-script.js
Last active Sep 23, 2015
Use the WordPress Media manager
View admin-script.js
/*
*
* Code générique qui permet d'utiliser le gestionnaire de media de WordPress
*
* Pour que ce code marche il faut ajouter le scripts de WordPress ( wp_enqueue_media() )
* et respecter quelques régles pour le HTML ( voir les fichier exemple.php et functions.php )
*
*/
var custom_uploader, name, input, size, preview;
@ArnaudBan
ArnaudBan / Preferences.sublime-settings
Last active Jan 4, 2016
Mes préférences pour pour Sublimes Text
View Preferences.sublime-settings
{
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
"detect_slow_plugins": true,
"draw_minimap_border": false,
"font_size": 12,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
@ArnaudBan
ArnaudBan / wordpress-constant
Last active Dec 26, 2015
Les constantes dans WordPress
View wordpress-constant
/*
* WordPress debug
* http://codex.wordpress.org/Debugging_in_WordPress
*/
define('WP_DEBUG', true);
// Log the error in wp_content/debug.log
define('WP_DEBUG_LOG', true);
// Show error only in debug.log
@ArnaudBan
ArnaudBan / px_to_em.scss
Last active Dec 16, 2015
Compass fonction to always work in em easily
View px_to_em.scss
@function px_to_em( $value, $context : 16 ){
@return ( $value / $context ) + 0em ;
}
@ArnaudBan
ArnaudBan / Ligne de commande utiles
Last active Nov 2, 2016
Les commandes en lignes dont je me sert
View Ligne de commande utiles
# Restart apach
sudo apachectl restart
# MySQL
mysql -h localhost -u user -p dbname < dump.sql // Importer des fichier SQL
mysqldump -h localhost -u user -pPassword dbname > dump.sql // Exporter des fichier SQL
# WordPress
## Get the latest french WordPress version
wget http://fr.wordpress.org/latest-fr_FR.zip
@ArnaudBan
ArnaudBan / function.php
Created Jun 25, 2012
WordPress function to show the "next-page" button in the tinyMCE
View function.php
// Add "Next page" button to TinyMCE
function add_next_page_button( $mce_buttons ) {
$pos = array_search( 'wp_more', $mce_buttons, true );
if ( $pos !== false ) {
$tmp_buttons = array_slice( $mce_buttons, 0, $pos+1 );
$tmp_buttons[] = 'wp_page';
$mce_buttons = array_merge( $tmp_buttons, array_slice( $mce_buttons, $pos+1 ) );
}
return $mce_buttons;
}
@ArnaudBan
ArnaudBan / mywidget.php
Created Jun 11, 2012
WordPress Widget - Show large form in the widget admin window
View mywidget.php
class My_Widget extends WP_Widget {
public function __construct() {
parent::__construct(
'mywidget', // Base ID
'My Widget', // Name
array(
'description' => 'This widget will show a large form',
'class' => 'mywidget-class'
),// Args