Skip to content

Instantly share code, notes, and snippets.

View jiceb's full-sized avatar
👋

Jean-Charles Bournot jiceb

👋
View GitHub Profile
@jiceb
jiceb / script.js
Created March 19, 2013 16:28
smoothly scroll ( jQuery )
$('html, body').animate({
'scrollTop': element.offset().top
}, 'slow', 'swing');
@jiceb
jiceb / gist:5003785
Created February 21, 2013 10:32
Responsive reset for images
/*
Article : http://blog.goetter.fr/post/13447625254/un-reset-responsive-pour-les-images
Demo : http://ie7nomore.com/fun/responsive-images/
*/
img { /* <img alt="" src="youhou.jpg" width="680" height="454"> */
max-width: 100%;
height: auto; width: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
@jiceb
jiceb / gist:4976230
Created February 18, 2013 09:38
AVG, MAX, MIN on meta_value in WordPress If you want to do MAX, MIN, AVG or other kind of mathematical operation on non-numeric MySQL columns (such as longtext for meta_value in WordPress), you can cast it to float like this:
/*
AVG, MAX, MIN on meta_value in WordPress
http://konstruktors.com/blog/wordpress/4554-avg-max-min-meta-value/
*/
SELECT
meta_key,
MAX(meta_value+0.0) max_meta
FROM
<?php
// http://speckyboy.com/2012/08/07/using-wordpress-to-create-a-micro-site-within-an-existing-theme
function magazine_post_type() {
register_post_type( 'magazine_', array(
'labels' => array(
'name' => __('Magazine Posts'),
'singular_name' => __('Magazine Edition'),
'add_new_item' => __('Create a New Edition' )
),
@jiceb
jiceb / style.css
Created January 28, 2013 13:33
CSS - Vertical centered
/* http://css-tricks.com/centering-in-the-unknown/ */
/* This parent can be any width and height */
.block {
text-align: center;
}
/* The ghost, nudged to maintain perfect centering */
.block:before {
content: '';
@jiceb
jiceb / gist:4109821
Created November 19, 2012 09:28
MySQL Dump All Databases and Create (or Recreate) them on Import
# export
mysqldump -u root -p --all-databases > all_dbs.sql
# import
mysql -u root -p < all_dbs.sql
@jiceb
jiceb / gist:4023889
Created November 6, 2012 10:22
Recursive Delete file type in Linux
cd /folder
# To get a confirmation for every file use:
find . -type f -name "*.bak" -exec rm -i {} \;
#To just delete all of a file type without a confirmation use:
find . -type f -name "*.bak" -exec rm -f {} \;
@jiceb
jiceb / gist:3910529
Created October 18, 2012 08:50
rsync
rsync -avz -e ssh [email protected]:/var/lib/rpm /root/temp
@jiceb
jiceb / gist:3858548
Created October 9, 2012 12:34
nginx server conf
server {
listen 80;
server_name website.loc www.website.loc;
access_log /var/log/nginx/website.access_log;
error_log /var/log/nginx/website.error_log;
root /home/web/website.loc/www/;
index index.php index.html index.htm;
@jiceb
jiceb / gist:3832266
Created October 4, 2012 08:33
Tar / Untar a folder
# tar a folder
tar -pczf web.tar.gz web/
# untar
tar xvfz web.tar.gz
tar xfz web.tar