<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>THE BLOWG</title>
	<atom:link href="https://blog.organicweb.fr/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.organicweb.fr/</link>
	<description>Le blog officiel d&#039;Organic Web</description>
	<lastBuildDate>Wed, 24 Jul 2024 09:07:09 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>The promise of a Burger Party</title>
		<link>https://blog.organicweb.fr/the-promise-of-a-burger-party/</link>
					<comments>https://blog.organicweb.fr/the-promise-of-a-burger-party/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Wed, 24 Jul 2024 09:07:09 +0000</pubDate>
				<category><![CDATA[Non classé]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Burger party]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Promise]]></category>
		<guid isPermaLink="false">https://blog.organicweb.fr/?p=2408</guid>

					<description><![CDATA[<p>This is a copy of Mariko Kosaka (@kosamari) notes, just to keep it available on the web. Two weeks ago, I was in a conversation about how I might implement a feature in JavaScript. It needed to be asynchronous to access external data, I said « well, let&#8217;s use fetch()&#8230;so in code&#8230; umm&#8230; » while I paused [&#8230;]</p>
<p>L’article <a href="https://blog.organicweb.fr/the-promise-of-a-burger-party/">The promise of a Burger Party</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>This is a copy of Mariko Kosaka (@kosamari) notes, just to keep it available on the web.</p>
</blockquote>



<p>Two weeks ago, I was in a conversation about how I might implement a feature in JavaScript. It needed to be asynchronous to access external data, I said « well, let&rsquo;s use <code>fetch()</code>&#8230;so in code&#8230; umm&#8230; » while I paused to remember fetch API, the person I was talking to said, « It returns a promise ». My brain froze, and I said: « I honestly don&rsquo;t know what you mean&#8230; »</p>



<p>I&rsquo;ve written promise based code plenty of times, but somehow things didn&rsquo;t connect in my brain this time. I realized I actually don&rsquo;t « get » promise after all.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>I can not tell you how hard it is to explain this sentence &#8211; « It returns a Promise »<br><br>but probably because I really don&rsquo;t understand Promise.— Mariko Kosaka (@kosamari) <a href="https://web.archive.org/web/20190521025537/https://twitter.com/kosamari/status/819972802220589056">January 13, 2017</a></p>
</blockquote>



<p>If you know me from twitter, I&rsquo;m a visual learner who <a href="https://web.archive.org/web/20190521025537/https://twitter.com/kosamari/status/806941856777011200">draws code concepts</a> as <a href="https://web.archive.org/web/20190521025537/https://twitter.com/kosamari/status/807303762188574720">physical metaphor</a>. It is how I cope with a double layer of abstraction (programming language &amp; English as a second language). So naturally, I had to draw it this time as well.</p>



<figure class="wp-block-image size-large"><img data-tf-not-load="1" fetchpriority="high" loading="auto" decoding="auto" fetchpriority="high" decoding="async" width="1024" height="768" src="https://blog.organicweb.fr/wp-content/uploads/2024/07/burger-party-1024x768.png" alt="The promise of a Burger Party" class="wp-image-2421" srcset="https://blog.organicweb.fr/wp-content/uploads/2024/07/burger-party-1024x768.png 1024w, https://blog.organicweb.fr/wp-content/uploads/2024/07/burger-party-300x225.png 300w, https://blog.organicweb.fr/wp-content/uploads/2024/07/burger-party-768x576.png 768w, https://blog.organicweb.fr/wp-content/uploads/2024/07/burger-party-1536x1151.png 1536w, https://blog.organicweb.fr/wp-content/uploads/2024/07/burger-party-2048x1535.png 2048w, https://blog.organicweb.fr/wp-content/uploads/2024/07/burger-party-1024x768-978x733.png 978w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Here is a piece of code we are going to look at in this story.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
// asynchronous operation
function cookBurger (type) { ... }

// regular operation
function makeMilkshake (type) { ... }

// order function which returns promise
function order (type) {
  return new Promise(function(resolve, reject) {
    var burger = cookBurger(type)
    burger.ready = function (err, burger) {
      if (err) {
        return reject(Error(&#039;Error while cooking&#039;))
      }
      return resolve(burger)
    }
  })
}

order(&#039;JakeBurger&#039;)
  .then( burger =&gt; {
    const milkshake = makeMilkshake(&#039;vanilla&#039;)
    return { burger: burger, shake: milkshake }
  })
  .then( foodItems =&gt; {
    console.log(&#039;BURGER PARTY !&#039;, foodItems)
  })
  .catch( err =&gt; {
    console.log(err)
  })

</pre></div>


<h2 class="wp-block-heading">Let&rsquo;s have a burger party</h2>



<p>Welcome to the Promise Square Park, home of a burger joint JakeShack. The burger at JakeShack is very popular but it has a limited number of cash registers to take orders, so the line is always long. However, the back kitchen is well staffed to take multiple orders at a time. In case you are not familiar, <a href="https://web.archive.org/web/20190521025537/http://www.foodsmackdown.com/2011/08/shake-shack-new-york-madison-square-park/">Madison Square Park and ShakeShack is a thing in New York City</a>. It&rsquo;s <em>really good</em>, but the line is always long.</p>



<h2 class="wp-block-heading">Promisify the action</h2>



<p>In order to take orders as quickly as possible, JakeShack uses a buzzer system. When a customer makes an order at a cash register, register staff hand you a tray and a buzzer in exchange of payment.</p>



<figure class="wp-block-image size-large"><img data-tf-not-load="1" decoding="async" width="1024" height="768" src="https://blog.organicweb.fr/wp-content/uploads/2024/07/promise-1024x768.png" alt="Promise" class="wp-image-2413" srcset="https://blog.organicweb.fr/wp-content/uploads/2024/07/promise-1024x768.png 1024w, https://blog.organicweb.fr/wp-content/uploads/2024/07/promise-300x225.png 300w, https://blog.organicweb.fr/wp-content/uploads/2024/07/promise-768x576.png 768w, https://blog.organicweb.fr/wp-content/uploads/2024/07/promise-1536x1151.png 1536w, https://blog.organicweb.fr/wp-content/uploads/2024/07/promise-2048x1535.png 2048w, https://blog.organicweb.fr/wp-content/uploads/2024/07/promise-1024x768-978x733.png 978w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>The tray is a promise from JakeShack that they will place its delicious burger on here once it&rsquo;s ready, and a buzzer is an indicator of order status. When buzzer is not beeping, it means the order is <strong>pending</strong> &#8211; the kitchen crew is busy at work processing your order. When buzzer turns red and beeps, it means the order is <strong>settled</strong>.</p>



<p>A bit of fine nuance here on <strong>settled</strong>. It is not equal to « ready ». It means the order has been processed in the kitchen and calling the customer to take action on it. You (a customer) probably want to pick up your order at the counter, but in some case, you might just walk away. It&rsquo;s up to you.</p>



<p>Let&rsquo;s look at what we have so far in code. When you call the <code>order</code> function, it « returns a promise » (giving you a tray with a buzzer). A return value (a burger) should appear on the tray once the promise is fulfilled and callback function called. More on that in next section!</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="768" src="https://blog.organicweb.fr/wp-content/uploads/2024/07/code-1-1024x768.png" alt="Code block 1" class="wp-image-2414" srcset="https://blog.organicweb.fr/wp-content/uploads/2024/07/code-1-1024x768.png 1024w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-1-300x225.png 300w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-1-768x576.png 768w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-1-1536x1151.png 1536w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-1-2048x1535.png 2048w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-1-1024x768-978x733.png 978w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Add Promise handlers</h2>



<p>Looks like the buzzer is beeping, let&rsquo;s go to the counter and claim the order. There are two scenarios you can expect at this stage.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="768" src="https://blog.organicweb.fr/wp-content/uploads/2024/07/settled-1024x768.png" alt="Sttled" class="wp-image-2415" srcset="https://blog.organicweb.fr/wp-content/uploads/2024/07/settled-1024x768.png 1024w, https://blog.organicweb.fr/wp-content/uploads/2024/07/settled-300x225.png 300w, https://blog.organicweb.fr/wp-content/uploads/2024/07/settled-768x576.png 768w, https://blog.organicweb.fr/wp-content/uploads/2024/07/settled-1536x1151.png 1536w, https://blog.organicweb.fr/wp-content/uploads/2024/07/settled-2048x1535.png 2048w, https://blog.organicweb.fr/wp-content/uploads/2024/07/settled-1024x768-978x733.png 978w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h4 class="wp-block-heading">1. Order fulfilled</h4>



<p>Hooray! your burger is ready, the kitchen staff hands you a freshly made burger. The promise of a good burger was fulfilled!</p>



<h4 class="wp-block-heading">2. Order rejected</h4>



<p>Looks like the kitchen ran out of burger patties, the promise of a burger was rejected. Make sure you get a refund for that!</p>



<p>Here is how you might prepare for these two situations in code.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="768" src="https://blog.organicweb.fr/wp-content/uploads/2024/07/code-2-1024x768.png" alt="Code block 2" class="wp-image-2416" srcset="https://blog.organicweb.fr/wp-content/uploads/2024/07/code-2-1024x768.png 1024w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-2-300x225.png 300w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-2-768x576.png 768w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-2-1536x1151.png 1536w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-2-2048x1535.png 2048w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-2-1024x768-978x733.png 978w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p><code>.then()</code> takes another function as the second argument which can also be used as a reject handler. For the sake of simplicity, I only use <code>.catch()</code> for reject in this article. If you want to know more about the difference, you might want to check out <a href="https://web.archive.org/web/20190521025537/https://developers.google.com/web/fundamentals/getting-started/primers/promises#error_handling">this article</a>.</p>



<h2 class="wp-block-heading">Chain the Promise</h2>



<p>Let&rsquo;s say your order was fulfilled, but you realized in order to have an ultimate burger party, you also need a milkshake&#8230; so you walk up to the C-line (a special line for drinks, <a href="https://web.archive.org/web/20190521025537/http://midtownlunch.com/2010/08/02/midtown-times-square-shake-shack-finally-add-a-c-line/">real thing at ShakeShack</a> for optimal crowd control). When you order a milkshake at the counter, a cashier gives you another tray and an another buzzer. Since milkshake is super quick to make, the cashier will hand you milkshake as well. No need to wait for the buzzer to beep (it&rsquo;s already beeping !).</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="768" src="https://blog.organicweb.fr/wp-content/uploads/2024/07/chaining-1024x768.png" alt="Settled" class="wp-image-2417" srcset="https://blog.organicweb.fr/wp-content/uploads/2024/07/chaining-1024x768.png 1024w, https://blog.organicweb.fr/wp-content/uploads/2024/07/chaining-300x225.png 300w, https://blog.organicweb.fr/wp-content/uploads/2024/07/chaining-768x576.png 768w, https://blog.organicweb.fr/wp-content/uploads/2024/07/chaining-1536x1151.png 1536w, https://blog.organicweb.fr/wp-content/uploads/2024/07/chaining-2048x1535.png 2048w, https://blog.organicweb.fr/wp-content/uploads/2024/07/chaining-1024x768-978x733.png 978w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Let&rsquo;s look at how it works in code. Chaining promise is as easy as adding another <code>.then()</code> in your code. Return from <code>.then()</code> is always a promise. Just remember each <code>.then()</code> returns you a tray and a buzzer, and an actual return value is passed as an argument to the callback.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="768" src="https://blog.organicweb.fr/wp-content/uploads/2024/07/code-3-1024x768.png" alt="Code block 3" class="wp-image-2418" srcset="https://blog.organicweb.fr/wp-content/uploads/2024/07/code-3-1024x768.png 1024w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-3-300x225.png 300w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-3-768x576.png 768w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-3-1536x1151.png 1536w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-3-2048x1535.png 2048w, https://blog.organicweb.fr/wp-content/uploads/2024/07/code-3-1024x768-978x733.png 978w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now that you have burger and milkshake, you are ready to BURGER PARTY <img loading="lazy" decoding="async" width="72" height="72" src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f389.png" alt="🎉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<h2 class="wp-block-heading">More party tricks!</h2>



<p>There are few more methods in promise that let you perform cool tricks.</p>



<p><code>Promise.all()</code> creates a promise that takes an array of promises (items). This promise fulfills when all of its items (each one is a promise) are fulfilled. Imagine you ordered 5 different burgers for your group but want to minimize a trip to the counter to only once when all 5 orders are ready. <code>Promise.all()</code> is a good solution for this.</p>



<p><code>Promise.race()</code> is similar to <code>Promise.all()</code>. But it is fulfilled or rejected as soon as one item fulfills or rejects. This can be used to simulate try and grab. If you are super hungry, you might order a burger, a cheeseburger, and a hot dog at the same time, only to pick up whatever the 1st order came out of the kitchen. (Note, in this analogy if the kitchen is out of burger patty and rejects the burger promise first, then the entire race promise will turn to rejected state.)</p>



<p>There are more details to cover in promise. Here is a further reading suggestion.</p>



<ul class="wp-block-list">
<li><a href="https://web.archive.org/web/20190521025537/https://github.com/mattdesl/promise-cookbook/blob/master/README.md">promise-cookbook</a> written in English (Chinese version available)</li>



<li><a href="https://web.archive.org/web/20190521025537/https://developers.google.com/web/fundamentals/getting-started/primers/promises">JavaScript Promises: an Introduction</a> written in English</li>



<li><a href="https://web.archive.org/web/20190521025537/http://azu.github.io/promises-book/">JavaScript Promiseの本</a> written in Japanese (Chinese and Korean version available)</li>
</ul>



<p>Thanks to Jake Archibald and Nolan Lawson for proofreading this post and suggesting changes! and Chris Wheatley, Juan Lopez, and Nicolas Dermine for fixing typo.</p>



<p><small>This post is published under <a href="https://web.archive.org/web/20190521025537/https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0 license</a>. Feel free to translate &amp; publish under the license.<br>Please let me know if you published a translation!</small></p>


<!-- wp:themify-builder/canvas /--><p>L’article <a href="https://blog.organicweb.fr/the-promise-of-a-burger-party/">The promise of a Burger Party</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/the-promise-of-a-burger-party/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Agrément Crédit impôt innovation</title>
		<link>https://blog.organicweb.fr/agrement-credit-impot-innovation/</link>
					<comments>https://blog.organicweb.fr/agrement-credit-impot-innovation/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Thu, 09 Oct 2014 17:08:16 +0000</pubDate>
				<category><![CDATA[Actu]]></category>
		<guid isPermaLink="false">http://blog.organicweb.fr/?p=770</guid>

					<description><![CDATA[<p>Nous sommes agréés au CII (Crédit impôt innovation), youpi !!! Depuis le 25 septembre 2014 et pour les années 2014 à 2018, Organic Web, Agence de création de sites internet à rennes, est agréé pour exécuter des travaux de conception de prototypes et installations pilotes éligibles au crédit impôt innovation.</p>
<p>L’article <a href="https://blog.organicweb.fr/agrement-credit-impot-innovation/">Agrément Crédit impôt innovation</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Nous sommes agréés au CII (Crédit impôt innovation), youpi !!!<span id="more-770"></span> Depuis le 25 septembre 2014 et pour les années 2014 à 2018, Organic Web, Agence de création de sites internet à rennes, est agréé pour exécuter des travaux de conception de prototypes et installations pilotes éligibles au crédit impôt innovation.</p>
<p>L’article <a href="https://blog.organicweb.fr/agrement-credit-impot-innovation/">Agrément Crédit impôt innovation</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/agrement-credit-impot-innovation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Des icônes comme FontAwesome</title>
		<link>https://blog.organicweb.fr/des-icones-comme-fontawesome/</link>
					<comments>https://blog.organicweb.fr/des-icones-comme-fontawesome/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Fri, 19 Sep 2014 18:07:57 +0000</pubDate>
				<category><![CDATA[Intégration]]></category>
		<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[FontAwesome]]></category>
		<category><![CDATA[icones]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[tutoriel]]></category>
		<guid isPermaLink="false">http://blog.organicweb.fr/?p=763</guid>

					<description><![CDATA[<p>Nous utilisons régulièrement Font Awesome, nous l&#8217;avons modifié et adapté. It&#8217;s Awesome ! Malheureusement, Font Awesome est lourd. Il contient une tonne d&#8217;icônes, plein d&#8217;entre eux nous sont inutiles. Nous devons souvent nous arranger d&#8217;une icône qui ne nous convient pas tout à fait. Comme Font Awesome est Awesome, mais avec des défauts, nous allons faire le notre [&#8230;]</p>
<p>L’article <a href="https://blog.organicweb.fr/des-icones-comme-fontawesome/">Des icônes comme FontAwesome</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p style="color: #525758;">Nous utilisons régulièrement <a href="http://fortawesome.github.io/Font-Awesome/" target="_blank">Font Awesome</a>, nous l&rsquo;avons modifié et adapté. It&rsquo;s Awesome !<span id="more-763"></span></p>
<p style="color: #525758;">Malheureusement, Font Awesome est lourd. Il contient une tonne d&rsquo;icônes, plein d&rsquo;entre eux nous sont inutiles. Nous devons souvent nous arranger d&rsquo;une icône qui ne nous convient pas tout à fait. Comme Font Awesome est Awesome, mais avec des défauts, nous allons faire le notre !</p>
<h2 style="color: #525758;">FontQuoiEncore ?</h2>
<p>FontAwesome est un set d&rsquo;icône au format vectoriel dans une police de caractère. Les caractères dans la police sont vos icônes.Les icônes au format vectoriel peuvent s&rsquo;agrandir sans détérioration ou lorsqu&rsquo;on les zooms, du coup ils peuvent être dans un format tout petit. Avec les écrans haute résolution (Rétine, 4k…) sur de plus en plus de support (tablette, mobiles et desktop), c&rsquo;est une bonne idée d&rsquo;en utiliser dans une application web ! Le seul écueil de cette pratique est que l&rsquo;icône ne peut être que d&rsquo;une seule couleur, mais vous pouvez ajouter quelques tricks CSS3 pour lui mettre un dégradé, de l&rsquo;ombre où je ne sais ce qui vous passe par la tête.</p>
<h2 style="color: #525758;">Créons donc notre set d&rsquo;icônes comme FontAwesome.</h2>
<p><a href="http://fontcustom.com/" target="_blank">Font Custom</a> est un outil pour convertir des images au format SVG en un format d&rsquo;icône FontAwesome-esque.Cet outil a besoin de quelques packages qui s&rsquo;installent à l&rsquo;aide de brew ou apt-get (Mac et Lunix pour le moment) et un gem ruby pour surveiller et compiler la police de caractères (tutoriel d&rsquo;installation).</p>
<p>Une fois installé, vous pouvez lancé la surveillance du dossier contenant vos SVGs il recompilera le dossier lorsque des changements interviendrons, vous pouvez également simplement lancé la compilation une fois vos SVGs prêts. La sortie de la compilation se composera de quelques fichiers du set d&rsquo;icônes pour une compatibilité inter navigateur et d&rsquo;un fichier CSS avec les classes correspondantes (vache.svg marchera avec icon-vache).</p>
<p>Une fois que vous aurez votre set d&rsquo;icônes construit, vous avez presque fini. Importer le fichier CSS, fichiers de police de caractères dans votre projet et ajouter la classe de l&rsquo;icône que vous souhaitez dans le DOM. Votre set d&rsquo;icône est prêt à être utilisé !</p>
<p>Attention, le tutoriel sur fontcustom contient des erreurs, pour installer fontforge avec brew, voici la commande qui marche pour à ce jour :</p>
<pre>brew install -v fontforge --HEAD --with-libspiro --enable-pyextension</pre>
<p>il faudra peut être en passer par un <code>brew update, brew doctor, brew uninstall fontforge, brew upgrade …</code> Enfin vous êtes grands !!</p>
<p>Enjoy !</p>
<p>L’article <a href="https://blog.organicweb.fr/des-icones-comme-fontawesome/">Des icônes comme FontAwesome</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/des-icones-comme-fontawesome/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>redirect avec des params dans le routing de rails</title>
		<link>https://blog.organicweb.fr/redirect-avec-des-params-routing-rails/</link>
					<comments>https://blog.organicweb.fr/redirect-avec-des-params-routing-rails/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Wed, 16 Apr 2014 12:13:28 +0000</pubDate>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[tips]]></category>
		<guid isPermaLink="false">http://blog.organicweb.fr/?p=753</guid>

					<description><![CDATA[<p>Bon vite fait bien fait, j&#8217;ai l&#8217;url suivant qui est entré dans les SERP de google, je dois donc le rediriger. /fr/produits?category_id=1 vers /fr/products?category_id=1 Pour ce faire, il suffit d&#8217;ouvrir le fichier config/routes.rb et d&#8217;y ajouter : match "/fr/produits", to: redirect { &#124;params, request&#124; "/fr/products?#{request.query_string}" } redirect avec des params dans le routing de rails [&#8230;]</p>
<p>L’article <a href="https://blog.organicweb.fr/redirect-avec-des-params-routing-rails/">redirect avec des params dans le routing de rails</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Bon vite fait bien fait, j&rsquo;ai l&rsquo;url suivant qui est entré dans les SERP de google, je dois donc le rediriger.<br />
<span id="more-753"></span><br />
<code>/fr/produits?category_id=1</code></p>
<p>vers</p>
<p><code>/fr/products?category_id=1</code></p>
<p>Pour ce faire, il suffit d&rsquo;ouvrir le fichier config/routes.rb et d&rsquo;y ajouter :</p>
<p><code>match "/fr/produits", to: redirect { |params, request| "/fr/products?#{request.query_string}" }</code></p>
<p>redirect avec des params dans le routing de rails !</p>
<p>Kudo</p>
<p>L’article <a href="https://blog.organicweb.fr/redirect-avec-des-params-routing-rails/">redirect avec des params dans le routing de rails</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/redirect-avec-des-params-routing-rails/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mettre à jour PostgreSQL de 9.2 à 9.3 avec homebrew</title>
		<link>https://blog.organicweb.fr/mettre-a-jour-postgresql-de-9-2-a-9-3-avec-homebrew/</link>
					<comments>https://blog.organicweb.fr/mettre-a-jour-postgresql-de-9-2-a-9-3-avec-homebrew/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Thu, 21 Nov 2013 16:01:00 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[tips]]></category>
		<guid isPermaLink="false">http://blog.organicweb.fr/?p=547</guid>

					<description><![CDATA[<p>J&#8217;ai utilisé avec plaisir PostgreSQL 9.2 installé par homebrew avec beaucoup de plaisir. Ce matin un brew upgrade a fini par mettre à jour PostgreSQL 9.3, qui entraine une incompatibilité de format. Voici comment migrer ses bases de données de 9.2 à 9.3. Note: Ces instructions sont valables uniquement si vous avez déjà installé PostgreSQL [&#8230;]</p>
<p>L’article <a href="https://blog.organicweb.fr/mettre-a-jour-postgresql-de-9-2-a-9-3-avec-homebrew/">Mettre à jour PostgreSQL de 9.2 à 9.3 avec homebrew</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>J&rsquo;ai utilisé avec plaisir PostgreSQL 9.2 installé par homebrew avec beaucoup de plaisir. Ce matin un brew upgrade a fini par mettre à jour PostgreSQL 9.3, qui entraine une incompatibilité de format. Voici comment migrer ses bases de données de 9.2 à 9.3.<span id="more-547"></span></p>
<p>Note: Ces instructions sont valables uniquement si vous avez déjà installé PostgreSQL 9.3. Ne désinstallez pas encore PostgreSQL 9.2, il est nécessaire pour le processus de mise à jour.</p>
<p>Je n&rsquo;avais pas encore remarqué le problème puisque mon ancienne version de PostgreSQL était encore en fonctionnement. Mais en redémarrant, la nouvelle version n&rsquo;a jamais démarré, et j&rsquo;ai trouvée ces erreurs dans : /usr/local/var/postgres/server.log :</p>
<pre><code>FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 9.3.1.</code></pre>
<p>La solution ? Éteindre le serveur, migrer le dossier de données vers le nouveau format compatible avec PostgreSQL 9.3et redémarrer.</p>
<h2>1. Éteindre PostgreSQL</h2>
<p>Puisque PostgreSQL a été installé à l&rsquo;aide de homebrew, il est piloté par le launchd system d&rsquo;Apple, la première étape est donc de dire à launchd de stopper l&rsquo;ancienne version : launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist</p>
<h2>2. Créer le dossier pour la nouvelle version de PostgreSQL</h2>
<p>Le processus de mise à jour requiert que l&rsquo;on migre les anciennes données vers un nouveau dossier. Il faut donc créer un nouveau dossier de données. Puisqu&rsquo;homebrew a déjà mis à jour vers PostgreSQL, la commande initdb est fonctionnelle.</p>
<pre><code>initdb /usr/local/var/postgres9.3 -E utf8</code></pre>
<h2>3. Lancer la migration à l&rsquo;aide pg_upgrade</h2>
<p>Heureusement, PostgreSQL est livré avec un utilitaire en ligne de commande pour effectuer la migration. Il faut spécifié le dossier des anciennes données et le binaire (-d et -b) ainsi que le nouveau dossier et le nouveau binaire (-D et -B) et hop c&rsquo;est parti !</p>
<pre><code>pg_upgrade 
-d /usr/local/var/postgres 
-D /usr/local/var/postgres9.3 
-b /usr/local/Cellar/postgresql/9.2.4/bin/ 
-B /usr/local/Cellar/postgresql/9.3.1/bin/ 
-v</code></pre>
<p>Une fois terminé, vous verrez, le message suivant :</p>
<pre><code>Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    analyze_new_cluster.sh

Running this script will delete the old cluster's data files:
    delete_old_cluster.sh</code></pre>
<h2>4. Déplacer le nouveau dossier en place</h2>
<p>Une fois la migration effectuée, il faut renommer le dossier à sa place :</p>
<pre><code>cd /usr/local/var
mv postgres postgres9.2.4
mv postgres9.3 postgres</code></pre>
<h2>5. redémarrer la nouvelle version de PostgreSQL</h2>
<p>Comme j&rsquo;ai installé le gem lunchy (cf <a title="Installer postgresql sur mac avec homebrew" href="http://blog.organicweb.fr/installer-postgresql-sur-mac-avec-homebrew">installer PostgreSQL sur mac avec Homebrew</a>), voici la commande :</p>
<pre>lunchy start postgresql</pre>
<p>Sinon :</p>
<pre><code>launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist</code></pre>
<p>On vérifie la version de PostgreSQL :</p>
<pre><code>psql postgres -c "select version()"</code></pre>
<h2>6. On fait le ménage dans les brew</h2>
<pre><code>brew cleanup postgresql</code></pre>
<h2>7. Si vous utilisez Ruby on Rails, recompilez le gem pg</h2>
<p>Finalement, une nouvelle version de PostgreSQL veut dire que des nouveaux binaires vont être utilisé par le gem pg. Donc pour faire tourner PostgreSQL avec rails il faut forcer une réinstallation du gem pg :</p>
<pre><code>gem uninstall pg
# Choose to remove "all versions"
# Re-install to force a recompile
gem install pg</code></pre>
<p>Et voila !</p>
<p>L’article <a href="https://blog.organicweb.fr/mettre-a-jour-postgresql-de-9-2-a-9-3-avec-homebrew/">Mettre à jour PostgreSQL de 9.2 à 9.3 avec homebrew</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/mettre-a-jour-postgresql-de-9-2-a-9-3-avec-homebrew/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>La taille de mon viewport</title>
		<link>https://blog.organicweb.fr/la-taille-de-mon-viewport/</link>
					<comments>https://blog.organicweb.fr/la-taille-de-mon-viewport/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Wed, 17 Jul 2013 10:19:01 +0000</pubDate>
				<category><![CDATA[Intégration]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[viewport]]></category>
		<guid isPermaLink="false">http://blog.organicweb.fr/?p=543</guid>

					<description><![CDATA[<p>Besoin de connaitre la taille de mon Viewport ? Et bien, ça se passe là : view_port_size</p>
<p>L’article <a href="https://blog.organicweb.fr/la-taille-de-mon-viewport/">La taille de mon viewport</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Besoin de connaitre la taille de mon Viewport ?</p>
<p><span id="more-543"></span></p>
<p>Et bien, ça se passe là : <a href="http://mattstow.com/viewport-size.html" target="_blank">view_port_size</a></p>
<p>L’article <a href="https://blog.organicweb.fr/la-taille-de-mon-viewport/">La taille de mon viewport</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/la-taille-de-mon-viewport/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SASS Compass et Blueprint ou les CSS à la cool</title>
		<link>https://blog.organicweb.fr/sass-compass-blueprint/</link>
					<comments>https://blog.organicweb.fr/sass-compass-blueprint/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Wed, 19 Jun 2013 08:35:24 +0000</pubDate>
				<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[Blueprint]]></category>
		<category><![CDATA[BreizhCamp]]></category>
		<category><![CDATA[Compass]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Sass]]></category>
		<guid isPermaLink="false">http://blog.organicweb.fr/?p=530</guid>

					<description><![CDATA[<p>Conférence sur SASS Compass et Blueprint au BreizhCamp édition 2013 Pour ceux qui ont suivi la conférences au BreizhCamp, voici les slides.</p>
<p>L’article <a href="https://blog.organicweb.fr/sass-compass-blueprint/">SASS Compass et Blueprint ou les CSS à la cool</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Conférence sur SASS Compass et Blueprint au BreizhCamp édition 2013</h2>
<p>Pour ceux qui ont suivi la conférences au BreizhCamp, voici les slides.</p>
<p><span id="more-530"></span><br />
<iframe loading="lazy" src="https://www.slideshare.net/slideshow/embed_code/23184082" width="1165" height="917" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe><br/></p>
<p>L’article <a href="https://blog.organicweb.fr/sass-compass-blueprint/">SASS Compass et Blueprint ou les CSS à la cool</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/sass-compass-blueprint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Une grille et plus vite que ça !</title>
		<link>https://blog.organicweb.fr/une-grille-et-plus-vite-que-ca/</link>
					<comments>https://blog.organicweb.fr/une-grille-et-plus-vite-que-ca/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Wed, 24 Apr 2013 14:05:40 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[grille]]></category>
		<category><![CDATA[Intégration]]></category>
		<guid isPermaLink="false">http://blog.organicweb.fr/?p=523</guid>

					<description><![CDATA[<p>En cas d&#8217;urgence, suivez le lien. Quel que soit votre problème de grille, gridcalculator est là pour vous sauver ! Export pour illustrator, photoshop et .PNG inclus.</p>
<p>L’article <a href="https://blog.organicweb.fr/une-grille-et-plus-vite-que-ca/">Une grille et plus vite que ça !</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>En cas d&rsquo;urgence, suivez le lien.</p>
<p><a href="http://gridcalculator.dk" target="_blank" rel="noopener"><span id="more-523"></span></a></p>
<p>Quel que soit votre problème de grille, <a href="http://gridcalculator.dk" target="_blank" rel="noopener">gridcalculator</a> est là pour vous sauver !</p>
<p>Export pour illustrator, photoshop et .PNG inclus.</p>
<p><a href="/wp-content/uploads/2013/04/Capture-gridcalculator.png"><img loading="lazy" decoding="async" class="alignnone wp-image-526 size-medium" src="/wp-content/uploads/2013/04/Capture-gridcalculator-300x247.png" alt="Grid Calculator" width="300" height="247" /></a></p>
<p>L’article <a href="https://blog.organicweb.fr/une-grille-et-plus-vite-que-ca/">Une grille et plus vite que ça !</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/une-grille-et-plus-vite-que-ca/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Installer postgresql sur mac avec homebrew</title>
		<link>https://blog.organicweb.fr/installer-postgresql-sur-mac-avec-homebrew/</link>
					<comments>https://blog.organicweb.fr/installer-postgresql-sur-mac-avec-homebrew/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Tue, 16 Apr 2013 12:22:17 +0000</pubDate>
				<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[homebrew]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[postgrsql]]></category>
		<guid isPermaLink="false">http://blog.organicweb.fr/?p=488</guid>

					<description><![CDATA[<p>L&#8217;installation et la configuration de Postgresql sur mac avec homebrew peut présenter quelques difficultés&#8230; Rien d&#8217;insurmontable, mais sans info ce peut être décourageant. Prérequis : Xcode a jour Homebrew installé Installation : Mise à jour de Homebrew On confirme que tout va bien : On install Postgres : Lors de l&#8217;installation, vous vous retrouvez avec [&#8230;]</p>
<p>L’article <a href="https://blog.organicweb.fr/installer-postgresql-sur-mac-avec-homebrew/">Installer postgresql sur mac avec homebrew</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>L&rsquo;installation et la configuration de Postgresql sur mac avec homebrew peut présenter quelques difficultés&#8230; Rien d&rsquo;insurmontable, mais sans info ce peut être décourageant.</p>
<p><span id="more-488"></span></p>
<p>Prérequis :</p>
<ul>
<li><span style="line-height: 13px;">Xcode a jour</span></li>
<li><a href="http://mxcl.github.io/homebrew/" target="_blank">Homebrew</a> installé</li>
</ul>
<h2>Installation :</h2>
<p>Mise à jour de Homebrew</p>
<pre class="brush: bash; title: ; notranslate">brew update</pre>
<p>On confirme que tout va bien :</p>
<pre class="brush: bash; title: ; notranslate">brew doctor</pre>
<p>On install Postgres :</p>
<pre class="brush: bash; title: ; notranslate">brew install postgresql</pre>
<p>Lors de l&rsquo;installation, vous vous retrouvez avec un sacré paquet de lignes dans le terminal, un peu comme ceci :<br />
<img src="data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20width='287'%20height='300'%20viewBox=%270%200%20287%20300%27%3E%3C/svg%3E" loading="lazy" data-lazy="1" decoding="async" class="tf_svg_lazy size-medium wp-image-506 alignnone" alt="installer postgreSQL sur mac avec Homebrew" data-tf-src="/wp-content/uploads/2013/04/iterm-install-postgresql-287x300.png" width="287" height="300" /><noscript><img decoding="async" class="size-medium wp-image-506 alignnone" alt="installer postgreSQL sur mac avec Homebrew" data-tf-not-load src="/wp-content/uploads/2013/04/iterm-install-postgresql-287x300.png" width="287" height="300" /></noscript></p>
<p>Les informations les plus importantes sont : <code>BuildNotes</code>, <code>Create/Upgrade a database</code> et <code>Start/Stop PostgreSQL</code>. Veuillez suivre ces informations à la lettre.</p>
<h2>Création / Mise à jour des bases de données</h2>
<p>Si c&rsquo;est la première installation de Postgres, vous devez créer une base à l&rsquo;aide la commande suivante :</p>
<pre class="brush: bash; title: ; notranslate">inidb /usr/local/var/postgres -E utf8</pre>
<p>Il est préférable de copier/coller la ligne depuis le terminal au cas ou la commande viendrait à changer !</p>
<h2>Installation de Lunchy</h2>
<pre class="brush: bash; title: ; notranslate"> gem install lunchy </pre>
<h2>Start/Stop Postgres</h2>
<p>Encore une fois, je copie/colle les commandes depuis le terminal. Notez bien que la deuxième commande dépend de la version de postgres installée sur ma machine. Si la version a changé, la commande ci-dessous ne fonctionnera pas, vous devez vous assurer que vous copiez bien la ligne depuis le terminal.</p>
<pre class="brush: bash; title: ; notranslate">
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.2.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
</pre>
<p>Puisque nous allons utiliser lunchy, cette dernière commande est inutile :</p>
<pre class="brush: bash; title: ; notranslate">launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist</pre>
<p>À la place, nous allons utiliser la commande suivante :</p>
<pre class="brush: bash; title: ; notranslate">lunchy start postgres</pre>
<p>À cet instant, vous pourriez penser que tout est prêt, eh bien non !</p>
<p>Lors de l&rsquo;installation de PostgreSQL à l&rsquo;aide de homebrew, le script ne créé pas l&rsquo;utilisateur posgres. Vous devez utiliser l&rsquo;utilisateur et le mot de passe du compte qui a servi à l&rsquo;installation de postgres. C&rsquo;est tout à fait acceptable de laisser cela ainsi dans un environnement de développement, mais n&rsquo;oubliez pas de changer cela si votre environnement est production !</p>
<h2>Instrumentation</h2>
<p>Installez instrumentation pour que <a href="http://www.postgresql.org/ftp/pgadmin3/" target="_blank">pgAdmin</a> ne passe pas son temps à vous crier dessus, lancez la commande suivante avec le même utilisateur qui a installé Postgres :</p>
<pre class="brush: bash; title: ; notranslate">psql postgres -c 'CREATE EXTENSION &amp;quot;adminpack&amp;quot;;'</pre>
<h2>Tester son installation</h2>
<p>Installer et lancer pgAdmin, ajouter une base de données avec votre username/password</p>
<p><cite>Merci à Russel Brooks et à Moncef Belyamani</cite></p>
<p>L’article <a href="https://blog.organicweb.fr/installer-postgresql-sur-mac-avec-homebrew/">Installer postgresql sur mac avec homebrew</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/installer-postgresql-sur-mac-avec-homebrew/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mercredi c&#8217;est TeFri avec les gros mots de Greg Frite</title>
		<link>https://blog.organicweb.fr/les-gros-mots-de-greg-frite/</link>
					<comments>https://blog.organicweb.fr/les-gros-mots-de-greg-frite/#respond</comments>
		
		<dc:creator><![CDATA[mathias]]></dc:creator>
		<pubDate>Thu, 24 Jan 2013 11:44:08 +0000</pubDate>
				<category><![CDATA[Actu]]></category>
		<category><![CDATA[Divertissement]]></category>
		<guid isPermaLink="false">http://blog.organicweb.fr/?p=477</guid>

					<description><![CDATA[<p>Pour les aficionados de la culture de rue, n&#8217;oubliez pas de dikave chaque mercredi les gros mots de Greg Frite&#8230; @GregFrite1er</p>
<p>L’article <a href="https://blog.organicweb.fr/les-gros-mots-de-greg-frite/">Mercredi c&rsquo;est TeFri avec les gros mots de Greg Frite</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Pour les aficionados de la culture de rue, n&rsquo;oubliez pas de dikave chaque mercredi les gros mots de Greg Frite&#8230;</p>
<p><span id="more-477"></span></p>
<p><a title="Suivez GregFrite1er sur twitter" href="http://twitter.com/GregFrite1er">@GregFrite1er</a></p>
<p>L’article <a href="https://blog.organicweb.fr/les-gros-mots-de-greg-frite/">Mercredi c&rsquo;est TeFri avec les gros mots de Greg Frite</a> est apparu en premier sur <a href="https://blog.organicweb.fr">THE BLOWG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.organicweb.fr/les-gros-mots-de-greg-frite/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
