Skip to content

Instantly share code, notes, and snippets.

View benfavre's full-sized avatar
💻
At the office

Webdesign29 benfavre

💻
At the office
View GitHub Profile
@benfavre
benfavre / gist:10023351
Created April 7, 2014 16:14
Php display taxonomy terms
<?php // Get terms for post
$terms = get_the_terms( $post->ID , 'oil' );
// Loop over each item since it's an array
if ( $terms != null ){
foreach( $terms as $term ) {
// Print the name method from $term which is an OBJECT
print $term->slug ;
?>
<?php
// Add custom meta to user profile screen
add_action( 'show_user_profile', 'example_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'example_show_extra_profile_fields' );
function example_show_extra_profile_fields( $user ) { ?>
<h3>Payment information</h3>
@benfavre
benfavre / eps_to_png.sh
Created September 11, 2014 19:44
Batch EPS to PNG with colorspace conversion croping and centering
for f in *.eps; do echo "Converting $f"; convert -colorspace sRGB $f -density 300 -quality 100% -colorspace rgb -flatten -resize 1200x1000^ -gravity center -crop 1200x1000+0+0 /var/www/suivisalades/public/media/images-produits/png/"$(basename "$f" .eps).png"; done
@benfavre
benfavre / gravity
Created December 12, 2014 17:46
Gravity forms Less - BOOTSTRAP
.gform_wrapper ul {
.list-unstyled();
}
.gform_wrapper li {
.form-group();
}
.gform_wrapper form {
margin-bottom: 0;
}
.gform_wrapper .gfield_required {
@benfavre
benfavre / league-ubuntu-linux
Created December 29, 2014 22:03
Patch League with tuxlol, for linux ubuntu League of legends
#!/bin/sh
# --- README ---
# Run this patch after every update or the game will crash before loading
# adjust paths if needed
# get tuxlol https://bitbucket.org/Xargoth/tuxlol/downloads
# get mono: apt-get install mono-runtime libmono-system-core4.0-cil
cd ~/.PlayOnLinux/wineprefix/LeagueOfLegends/tuxlol/
mono tuxlol.exe patch --dir ../drive_c/Riot\ Games/League\ of\ Legends/ -- no-backup
@benfavre
benfavre / gist:4161262
Created November 28, 2012 13:24
Wkhtmltopdf php example
<?php
ini_set('memory_limit', '210000M');
$command = "wkhtmltopdf-i386 --redirect-delay 100 --disable-smart-shrinking --print-media-type --margin-bottom 0mm --margin-left 0mm --margin-right 0mm --margin-top 0mm --dpi 96 'http://elwglobalarmour.com/shop/military-assault-vest/' /var/www/clients/carteweb.jeanstalaven.fr/www/2012_PDFHD/pdf-james.pdf";
exec($command);
$file = "/var/www/clients/carteweb.jeanstalaven.fr/www/2012_PDFHD/pdf-james.pdf";
@benfavre
benfavre / wd-video-import.json
Created December 18, 2012 11:55
Wd-video Json Pod Import
{"meta":{"version":"1.14.4","build":"1355831614"},"pods":{"1":{"name":"wd_video","label":"","is_toplevel":"1","detail_page":"","list_filters":"","pre_save_helpers":"","pre_drop_helpers":"","post_save_helpers":"","post_drop_helpers":"","fields":[{"name":"name","label":"Name","comment":null,"coltype":"txt","pickval":null,"weight":null,"display_helper":null,"input_helper":null,"pick_filter":null,"pick_orderby":null,"required":"1","unique":null,"multiple":null},{"name":"video_url_flv","label":null,"comment":null,"coltype":"txt","pickval":null,"weight":"4","display_helper":null,"input_helper":null,"pick_filter":null,"pick_orderby":null,"required":null,"unique":null,"multiple":null},{"name":"video_url_ogg","label":null,"comment":null,"coltype":"txt","pickval":null,"weight":"8","display_helper":null,"input_helper":null,"pick_filter":null,"pick_orderby":null,"required":null,"unique":null,"multiple":null},{"name":"video_length","label":null,"comment":null,"coltype":"txt","pickval":null,"weight":"11","display_helper":n
@benfavre
benfavre / pods2.x_gravityforms_helper.php
Last active December 10, 2015 05:58 — forked from anonymous/gravityforms.php
Pods 2.0 Gravity Forms input helper. Use a text or code field.
<?php
wp_enqueue_style( 'pods-select2' );
wp_enqueue_script( 'pods-select2' );
$attributes = array();
$attributes[ 'tabindex' ] = 2;
$pick_limit = (int) pods_var( 'pick_limit', $options, 0 );
$name .= '[]';
$attributes[ 'multiple' ] = 'multiple';
if ( !is_array( $options[ 'data' ] ) && false !== $options[ 'data' ] && 0 < strlen( $options[ 'data' ] ) )
@benfavre
benfavre / pods2.x_orderable_gravityforms_helper.php
Created December 28, 2012 14:07
Uses a hidden input and saves only the name. This one allows you to order the selection
<?php
wp_enqueue_style( 'pods-select2' );
wp_enqueue_script( 'pods-select2' );
$attributes = array();
$attributes[ 'type' ] = 'text';
$attributes[ 'value' ] = $value;
$attributes[ 'tabindex' ] = 2;
$attributes = PodsForm::merge_attributes( $attributes, $name, PodsForm::$field_type, $options );
@benfavre
benfavre / gravity_forms_bootstrap_wordpress.php
Created December 28, 2012 15:15
Add Bootstrap "btn" class to the submit input of gravity forms
// filter the Gravity Forms button type
add_filter("gform_submit_button", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
return "<input type='submit' class='button gform_button btn btn-flat' id='gform_submit_button_{$form["id"]}' />";
}