Open files or folders in Atom from OSX Finder

Mac computers come with the Automator application.

Open it.

Create a new “Service” : File > New > Service.

In the library of actions on the left sidebar, you will find one called Run Shell Script : add it to the workflow.

Set the service to receive selected files or folders, the shell as /bin/zsh, and the input to be passed as arguments.

Then enter /Applications/Atom.app/Contents/MacOS/Atom -n $@ in the text area.

Finally, save the workflow as “Open in Atom”.

And you are done !

A different Domain for each Language with qTranslate

Hey folks,

I like to use qTranslate for my multilingual websites. Today I had to set up a different language for each domain pointing on my WordPress installation. Here’s what was the simplest solution.

Multidomain qTranslate Settings

First, in your administration panel, in Settings > Languages, in Advanced Settings > URL Modification Mode, make sure you Use Pre-Path Mode.

Then, in your .htaccess (which shall be around your root directory), above the Rewrite Rules, redirect each one of those pre-paths to the wanted domain.

RedirectMatch 301 /fr/(.*) http://www.francais.fr/$1
RedirectMatch 301 /en/(.*) http://www.english.co.uk/$1

Too easy. Now in your theme’s functions.php file, configure qTranslate’s language settings according to the current domain. Let’s reset WordPress URLs as well, so it always link to the current domain.

define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );
$current_domain_lang = array_search( str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ), array(
'fr' => 'francais.fr',
'en' => 'english.co.uk'
) );
$q_config['language'] = $current_domain_lang;
$q_config['default_language'] = $current_domain_lang;

Should work like a charm… tell me if you notice an issue though.

Omnifinder, a Time-Saving Search Engine

Hey guys, if you didn’t came across Omnifinder yet, give it a try.

It allows you to search straight on any defined or customised website, instead of having to reach its searching page. One landing page for them all, that’ll make you save some precious seconds !

It’s my friend Maxime‘s work (the guy that made Canvas Rider), and he made it efficient as usual.

Mes jolies cartes de visite

On appellerait bien ça du “personal branding”, sous mon statut d’indépendant.

J’ai donc eu le plaisir de réaliser, accompagné de l’agence de communication KlubGraphik, ces cartes de visites pour mon auto-entreprenariat !

Bon alors bien sûr il faut les voir en vrai, toutes vernies mat et découpées arrondies qu’elles sont. En tout cas, bravo à Pascal pour ce joli design.

C’est peut-être anodin pour beaucoup ces cartes, mais ça marque pour moi l’affirmation de cette fraîche situation dont je souhaite d’ores et déjà communiquer le professionalisme.

Au plaisir, donc, de vous en remettre une en main propre !

Exclude a product category with WordPress E-Commerce Plugin

// The categories we want to exclude.
$exclude_categories = array(5, 10, 2);
while (wpsc_have_products()) :  wpsc_the_product();
  $category = get_the_product_category( wpsc_the_product_id() );
  if ( !in_array( $category[0]->term_id, $exclude_categories ) ) :
    // Here you display...
  endif;
endwhile;

And yeah, if you want to exclude a top level category, try something like this :

function get_term_top_parent_id( $term_id, $taxonomy ) {
  $parent = get_term_by( 'id', $term_id, $taxonomy );
  while ( $parent->parent != 0 ) {
    $parent = get_term_by( 'id', $term_id, $taxonomy );
  }
  return $parent->term_id;
}

// ...

$exclude_categories = array(5, 10, 2);
while (wpsc_have_products()) :  wpsc_the_product();
  $category = get_the_product_category( wpsc_the_product_id() );
  if ( !in_array( get_term_top_parent_id( $category[0]->term_id, 'wpsc_product_category' ), $exclude_categories ) ) :
    // Here you display...
  endif;
endwhile;

Vous pouvez en choisir deux

Fast, cheap or great

Je suis tombé sur sur ce diagramme réalisée par Colin Harman, et cela m’a rappelé la pyramide que mon boss de l’époque présentait quelquefois aux clients.

Celui-ci est titré pour du design, mais je l’ai vu s’appliquer à de divers projets de communication. L’idée, c’est qu’on ne peut pas raisonnablement vendre pour des cacahuètes (cheap) quelque chose de génial (great) dans un délai serré (fast)… Je vous laisse méditer là-dessus.

Responsive Adsense Plugin for WordPress

Responsive Adsense Plugin

I recently posted about a way to display different sizes of adverts depending on the window size. I’m sure it could be useful for a lot of people, so… I made it a WordPress plugin.

It’s a simple widget that works with your Google Adsense “Publisher ID” and some of your Advert Units IDs.

It will display on your pages the bigger unit that can fit in the widget container.

Enjoy folks !

Make your Google Adsense blocs fit your responsive design !

This is actually quite simple. The thing is to set the ad parameters depending on the window’s size before we call the show_ads.js script.

google_ad_client = "ca-pub-XXXXXXXXXXXXXXXX";
if ( window.innerWidth>979 || window.innerWidth<768 ) {
  // If the window is larger than 979px or smaller than 768px, we set the first bloc
  google_ad_slot = "XXXXXXXXXX";
  google_ad_width = 300;
  google_ad_height = 250;
} else {
  // Otherwise, we set the second one.
  google_ad_slot = "XXXXXXXXXX";
  google_ad_width = 200;
  google_ad_height = 200;
}