<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Baptiste Lecocq on Medium]]></title>
        <description><![CDATA[Stories by Baptiste Lecocq on Medium]]></description>
        <link>https://medium.com/@tiste?source=rss-84f3a3ee0801------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nT5LPjMkoDYVpH-um62POA.jpeg</url>
            <title>Stories by Baptiste Lecocq on Medium</title>
            <link>https://medium.com/@tiste?source=rss-84f3a3ee0801------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 05:30:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tiste/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Scrum team journey (at the countryside)]]></title>
            <link>https://medium.com/adeo-tech/a-scrum-team-journey-at-the-countryside-3f019c6d9f54?source=rss-84f3a3ee0801------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f019c6d9f54</guid>
            <category><![CDATA[fun]]></category>
            <category><![CDATA[lockdown]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[lifeatadeo]]></category>
            <dc:creator><![CDATA[Baptiste Lecocq]]></dc:creator>
            <pubDate>Thu, 22 Jul 2021 15:47:43 GMT</pubDate>
            <atom:updated>2021-07-23T13:09:39.401Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z78cMKoSyDqRS8ULrCBJ5Q.png" /></figure><p>At the end of June, we, as the Knowledge Graph team*, keep working with all the team ceremonials as they should be, while respecting the Scrum Sprint and release objectives. And, to be honest, we were in a good mood regarding the schedule.</p><p>Despite this, a recurring need of the team was felt: to see each other. We are people who know well each other, but whose team is new from the start of lockdown (1 year ago). The fact of working together on a daily basis is only known behind computers, but rarely physically. One solution: meet each other to work together and have a good time outside of work.</p><p>* Antoine Caron, Baptiste Lecocq, Charles Gouwy, Chunpeng Xing, Delphin Aubin and Vivien Longuet.</p><h4>“Lightness, a swimming pool and a barbecue”</h4><p>Here are the words that prompted us to rent a cottage in the countryside of Saint-Omer, 1 month later.</p><p>While thinking on this seminar initiative, an idea rose up: <strong>let’s shake things up</strong>. It is true that a certain pressure was felt during our Sprints, in particular due to remote working, but also due to development and organizational practices which were so well mastered, that could sometimes restrict us to innovation.</p><p>To innovate, our wish was the following: a high speed of delivery. By the end of this week, a usable deliverable had to be in production. We therefore ignored certain good practices, such as DDD, BDD. But we still wanted to keep focus on low-level practices, such as TDD on business value features.<br>To make this possible, we are really proud in having a sane, clean, and high-quality codebase that was easy to squeeze into. In less than 2 hours, we were able to put into production a version of the new “showcase” product, capable of connecting to our data source. In fact, it was a blank page, with “Hello World!”, deployed in dev/preprod/prod environments, linked to the CI, plugged to our databases, with all of our technical tools ready to use.<br>Moreover, some ceremonials have been questioned, in order to save time, but above all, to focus on their real value:</p><ul><li>no need to have daily meeting, as we were in constant synchronization</li><li>no need to have sprint planning, as we knew what to do, and which order of priority</li></ul><h4>The product</h4><blockquote>The knowledge graph is a way to build on the extended knowledge of products, to be useful to residents.</blockquote><p>This knowledge is, at the moment, split in the expertise of all the people of Leroy Merlin. Our goal is to centralize it, make it understandable, and help teams to use it, to meet specific needs.</p><p>So far, workshops have been set up by members of our team (PO, developers, taxonomists) in order to understand the need, and to model knowledge to meet this need. Use-cases are already in production regarding the knowledge already modeled, but it could be even more interesting to receive contributions directly from collaborators.</p><p>We’ve decided to pause the current release, in order to embark on an idea allowing collaborators to provide us a great feedback on the work we are daily doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81SoE3WHk2N16IEaisrWCg.jpeg" /><figcaption>“All starts with a sketch”</figcaption></figure><h4>Collaborators at the heart of knowledge</h4><p>To start this idea, we simply grouped together around a paper sheet, drawing the simplest and most rewarding features for the user:</p><ul><li>suggestions for new data (see: Screenshot PoC (5)),</li><li>vote on suggestions,</li><li>discover already integrated knowledge (see: Screenshot PoC (1, 4)).</li></ul><p>A codebase was placed on the existing one, mastered by all (NestJS). Some new technical choices have also been made, for the simple purpose of having fun (React).</p><p>Then, in a second step, our concern was to make the collaborator want to participate, to bring him into a game…<br>Why not use the principles of gamification?</p><ul><li>Some actions are worth more points than others.</li><li>Points system allow you to gain levels (see: Screenshot PoC (2)).</li><li>Levels are unknown, and are discovered over time.</li><li>A leaderboard stirs up the most playful among us, to become the best handyman of ADEO / Leroy Merlin (see: Screenshot PoC (3)).</li></ul><figure><img alt="Screen" src="https://cdn-images-1.medium.com/max/1024/1*6FCbplJK1B9PU38gm5id6Q@2x.png" /><figcaption>Screenshot PoC</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7Qo77io0h3MSmwewHo7zg@2x.png" /><figcaption>Screenshot PoC</figcaption></figure><h4>A retrospective full of enthusiasm</h4><p>The week of the seminar being over, we undertook a retrospective in order to perpetuate what worked very well during these days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ISoCm8mffVsksjToNyUGNA.png" /></figure><p>There are many more post-its that we won’t show here 😉, but the recurring topic is lightness in decision-making:</p><ul><li>leadership was taken by all team members,</li><li>the right to make mistakes has enabled us to ship more quickly,</li><li>the technical points (architecture, features, dev practices, etc.) are shared between each other,</li><li>the challenge was met with additional features, without stress,</li><li>trust is greater among all team members,</li><li>the recognition of the organization is strong.</li></ul><h4>Result is making noise</h4><p>To sum up: it’s a real success for the team. The goal was achieved in 4 days of development, in a good mood, in a restful and rejuvenating environment, while making “wow effect” around us.<br>For the first 2 days of going live, there are already more than 60 suggestions made by collaborators.</p><ul><li>ADEO is a place that was able to give us the opportunity to experiment, and we took it with open arms. The trust that we have in each other has been crucial in bringing this moment of life to a successful conclusion.</li><li>Thanks to the constant quality of the project we are working on, it was very easy to get involved in order to build a project from scratch. Indeed, in 2 hours of time, a new product was born until production.</li><li>It is great to take some time off the daily routine, to re-focus on <strong>the heart</strong> of all of the practices we used to do: why are we doing daily meeting? Why are we doing multiple kind of tests? Why this daily thing is taking so much time? Can we decrease it?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DVjFzGOsxBs8PSfGBszO7A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5DXIroqyRRci-8RBjbLYYA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f019c6d9f54" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adeo-tech/a-scrum-team-journey-at-the-countryside-3f019c6d9f54">A Scrum team journey (at the countryside)</a> was originally published in <a href="https://medium.com/adeo-tech">ADEO Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keep improving, the retrospective way, in a COVID-19 context]]></title>
            <link>https://medium.com/adeo-tech/keep-improving-the-retrospective-way-in-a-covid-19-context-35759e5430a7?source=rss-84f3a3ee0801------2</link>
            <guid isPermaLink="false">https://medium.com/p/35759e5430a7</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[experience]]></category>
            <category><![CDATA[lifeatadeo]]></category>
            <category><![CDATA[retrospectives]]></category>
            <category><![CDATA[kindness]]></category>
            <dc:creator><![CDATA[Baptiste Lecocq]]></dc:creator>
            <pubDate>Tue, 28 Apr 2020 10:17:22 GMT</pubDate>
            <atom:updated>2021-01-20T08:12:55.725Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HEb3R3qalYK_sKGBkMgsyw.gif" /><figcaption>“Speed-boat” retrospective in Miro during COVID-19</figcaption></figure><p>I work for Adeo/Leroy Merlin in a Common Digital Platform project, building products in an Agile way. Now the words “digital”, “products” and “Agile” are said in same sentence, I can follow up.</p><p>Most of our habits have changed since the outbreak of the COVID-19 virus. For example, we used to tackle problems that we can handle easily in the feature team, but now that we’re all shut in our houses, many topics seem harder to work on, such as “I worked close to that other team, what’s up now?”, or “we used to do the daily meeting in front of the board, I can’t now!”, or even “I don’t know how to get informed often about COVID-19 decisions of the company”. Most of the deal is to get those topics back to our <a href="https://customizinglife.com/stop-worrying/">circle of influence (Stephen Covey’s</a>).</p><p>With preparation, organization, and feedback, we managed to find something that works for us. Success is about “done” topics, involving people, and enhancing the motivation and sanity of teams. This is how we do retrospectives.</p><h4>Background</h4><p>We are composed of 7 feature teams that all have their own Agile culture. We tend to follow Kent Beck XP’s principles as a general rule.<br>We also coordinate and align together with circles, and a higher-circle, following <a href="https://en.wikipedia.org/wiki/Sociocracy">Sociocracy</a>’s principles, formed by double linking of the functional leader and a representative of each circle.<br>Still, we’re sharing some Scrum ceremonies: Sprint, Demo, and Retrospective.</p><p>Regarding sprints, it’s a <strong>one week</strong> duration time in which each team keeps a relative degree of freedom on how they organize their own. No more.</p><p>About the demo, I won’t take your time in this article, but you can read a really good one from a colleague of mine, Gaetan: <a href="https://medium.com/leroymerlin-tech-digital/story-of-a-weekly-demo-the-xp-way-d2553282e2a6">Story of a weekly demo, the XP way</a>.</p><p>Yes, there are retrospectives. Every team usually do their own retrospectives their own way: you can find some games, some round tables, or sometimes more academic retros. The goal: keep focusing on actions. But now we’ve entered in the Coronavirus outbreak, other problems rose up about organization, ways to communicate, to work, etc.<br>Now, retrospectives are still a way to <strong>improve ourselves</strong>, but also to tackle “higher level” topics that make sense in that weird phase, helping us to take actions to <strong>work better together</strong> and to <strong>shorten the feedback loop</strong> between teams and company leaders.</p><h3>Iterations</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*Dtm2bcyWTSYlOD_-QVbHWg.png" /></figure><p>Lockdown, first week. Quite a big news for everyone to get back home, but we continue working together. Many questions rose up into teams about “how to work together”, or “how can we continue collective code review”, or even “can we do some break times”?</p><p>We decided to use a tool called <a href="https://discordapp.com/">Discord</a>, in which we <a href="https://twitter.com/tiste/status/1235877867361271809">virtualized all teams and rooms</a> we have physically. It’s a voice chat that helps us to communicate live with each member of the team. Then, we decided to mark a time in our agenda, after the sprint review for a “global meeting” in where we could ask questions, improve some things, etc.</p><p>We knew after that we decided to have a <strong>global retrospective</strong> all together (I mean, the 7 feature teams and company leaders) to work on improvement.</p><h4>First try: the “report” retrospective</h4><p>It was such a mess. Everybody wanted to talk, to propose stuff. So we tried to organize things:</p><ul><li>ascribe was writing feedback of each person on Google Docs. The main goal was to give the possibility to speak to everyone, to keep up with others, in fact: to be in a situation as real as possible. <em>~40 minutes</em></li><li>then we all went to the same Docs, to propose actions we could do to make our life easier in these times. There were like 20 lines of propositions, all Google Docs cursors blinking everywhere. <em>~40 minutes</em></li></ul><p>Still, we decided to choose the main topic that emerged: how can we get news from the company on the next steps (of the lockdown).</p><blockquote><strong>Action</strong>: the double linking of each circles does a global short meeting each day to gather useful information of everyone and of the company, to broadcast if necessary to all teams (remember <em>Background</em> part, we follow <a href="https://en.wikipedia.org/wiki/Sociocracy">Sociocracy</a>’s principles).</blockquote><p><strong>We liked</strong>: success to tackle <strong>a single action</strong>, that really helps us (still present).<br><strong>We disliked</strong>: …it’s okay for the first iteration, a bit long, but let’s continue!</p><h4>Tried again, still too long</h4><p>A similar structure was followed:</p><ol><li>scribe to gather individual feedback <em>~40 minutes</em></li><li>then individual proposals <em>~40 minutes</em></li></ol><p>But this time, 12 topics were proposed. I let you imagine 7 feature teams composed of around 5 persons, trying to write at the same time on Google Docs, then voting with a “+1” at the end of each proposal…<br>We tried to tackle them one per one with that 7 feature teams…, and it lasted at least 30 minutes more, without real action.</p><p>We decided to stop the retro and find a better organization for the next one.</p><blockquote><strong>Action</strong>: Work on an easier retrospective that still involve people, but reduce time and make it more straightforward.</blockquote><p><strong>We liked it</strong>: we keep in touch with every people on every team. It’s cool to be together.<strong><br>We disliked</strong>: takes too much time, too messy, and too many topics were proposed.</p><h4>Brand new way: more interactions and involvement</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HEb3R3qalYK_sKGBkMgsyw.gif" /><figcaption>“Speed-boat” retrospective in Miro during COVID-19</figcaption></figure><p>Based on the feedback we got from previous retrospectives, the goal was to limit input topics, to reduce time, and to enhance interactions.</p><p>Here are the rules we defined together:</p><ul><li>per team, try to think about topics in feature team retrospectives, that can be shared with all teams at the global one</li><li>limit the number of topics per team (ex: 2)</li><li>one person per team present their topics to speed up the presentation phase</li></ul><p>I chose to switch to a more interactive/visual way to do retrospective thanks to <a href="https://miro.com/">Miro</a>, an online collaborative whiteboard platform. You can define by colors each team you work with (c.f. gif, on the left) so that we can remember which team proposed which topic.</p><ol><li>The global format is simple: free talk to let everyone speak about their sprint, mood, troubles, etc. To us, it’s important to involve people, everyone must have a chance to speak. <em>~20 minutes</em></li><li>The second part is the “production” part. Start by remembering all the actions that have been decided to follow them if necessary <em>~5 minutes</em>.<br>Then, I like to remember that one thing:</li></ol><blockquote>No matter what we discover, we understand that everyone has given their best, given the situation, what is known about the project, their skills and the available resources.</blockquote><p>It helps people to accept failures and to be proud of what has been done.</p><p>3. Then, give <em>~10 minutes</em> to each team to present their topics and to place it live to Miro. It shouldn’t take more time, as teams already prepared topics. During that time, it’s important to focus on which post-its can be gathered to make a common topic to tackle.</p><p>4. It is now time to vote. For around <em>~5 minutes</em>, people place two-dot votes into a group of topics.</p><p>5. You can now choose which group of topics you want to tackle. From previous feedback: choose only 2~3 topics so that you can really manage it for the next sprint.</p><p>6. A leader is set to lead a topic, and everybody split into two different Discord channels to talk about these selected topics. <em>~20 minutes</em></p><p>7. Then, everybody gets back to the common Discord channel and topic leaders present what has been decided. Following the sociocracy principle, if no one has an objection, the decision/action will be put into place to the following sprint (or more). If there is, a new proposition should be made. <em>~10 minutes</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*4jftcuR_P75Tjb0zFqxg9Q.png" /></figure><p>8. Final step, take feedback. Propose a <a href="https://www.myagilepartner.com/blog/index.php/2019/06/03/quick-feedback-with-the-roti/">ROTI</a>. It is a good way to improve yourself, and some small discussions can happen. Remember, don’t challenge feedback, keep improving.</p><p>9. (optional, or not) open a live show, and have a drink all together :)</p><p>We were now able to collaborate together during the retrospective. We could now correctly think about improving our organization.</p><p><strong>We liked</strong>: organized topics, timeboxed, the ability for everyone to talk.<br><strong>We disliked it</strong>: it’s really hard to keep timeboxes fixed. We sometimes take 15 minutes more.</p><h4>Feature team retro, global retro, isn’t it too much?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nw_SFgKNuulqvzSZsyEd-g.gif" /><figcaption>“Remember the future” retrospective during COVID-19</figcaption></figure><p>We keep continue and adapt global retrospectives to the context (ex: product release). The one above was “remember the future”, which helps us to focus on a future release that was difficult in terms of deadlines, security, user acceptance tests, etc.</p><p>But time was really important.<br>A topic emerged to discuss time allowed to meetup. The global retrospective was one of them, because across sprint planning/refinement/review and team retrospective each week (size of a sprint), the global one of ~1 hour was too long. So we reviewed the different parts of that “big retro”.</p><blockquote><strong>Action</strong>: keep the first part “free talk” of the global retrospective, then share teams topics all together. For the second “production” part, keep at least <em>one member of each team</em> to tackle subjects. His responsibility were to share decisions to the people who left.</blockquote><p><strong>We like</strong>: everybody still has time to express and share things together. Fears/non-controlled topics are highlighted to the “production” part of the global retro. If you lack some time, or you are not interested in global topics, you can leave, and a member of your team will sum up decisions after.<br><strong>We dislike</strong>: … it’s the current version of the global meeting.</p><h3>Sum up</h3><blockquote>We want to keep our work and interactions with others comfortable in a context of lockdown.</blockquote><p>By setting a global retrospective, it helps us to take actions to better work together and to shorten the feedback loop between teams and company leaders. Here are some rules to takeaway:</p><ul><li>prepare a few topics per team during feature team retrospectives</li><li>fewer topics, more concrete actions</li><li>share global retrospective board before T time, to let the others adapt to the game/support</li><li>introduce retrospective as a time to improve our ways to work, without blaming anyone</li><li>let people choose (and change over time) a leader for each team, to speak about their topics</li><li>focus on timeboxes</li></ul><p>These key points were tested over multiple retrospectives and give us good metrics over some success points we defined:</p><ul><li>“done” topics: 2 actions per retrospective</li><li>involving people: increasing ROTI</li><li>enhancing motivation and sanity of teams: everyone feels comfortable with the retrospective, and we keep improving our organization.</li></ul><p>For us, the retrospective is a good way to inspect and improve our way to work, to collaborate. It is really important during that specific time to focus on positivity, involvement, and productivity, to live a captivating and comfortable time.<br>It may happen that people ask to reduce retrospectives occurrences, so it may be a good time to rework the way you retrospect, rather than giving up and let things rot.<br>Remember, the retrospective is a way to give the power to the team, to gain more control.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35759e5430a7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adeo-tech/keep-improving-the-retrospective-way-in-a-covid-19-context-35759e5430a7">Keep improving, the retrospective way, in a COVID-19 context</a> was originally published in <a href="https://medium.com/adeo-tech">ADEO Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack your garage door for $10]]></title>
            <link>https://medium.com/@tiste/hack-your-garage-door-for-10-42146830e147?source=rss-84f3a3ee0801------2</link>
            <guid isPermaLink="false">https://medium.com/p/42146830e147</guid>
            <category><![CDATA[hacks]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[esp8266]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Baptiste Lecocq]]></dc:creator>
            <pubDate>Wed, 23 May 2018 11:37:45 GMT</pubDate>
            <atom:updated>2018-05-23T11:37:45.375Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m not a super duper IoT guy. I try to make things with my only baggage as a software engineer, small knowledge of electricity… and a lot of curiosity.</p><p><strong>WARNING</strong>: this article is (unfortunately) in close relation with the <a href="https://en.wikipedia.org/wiki/Wife_acceptance_factor">WAF</a> (Wife Acceptance Factor), so take care.</p><h4>Intro</h4><p>I was always faced to my garage door, struggling by searching my remote lost in my bag (yes, it’s huge enough, but no way to have it in my pocket). After removing all the Mac/iPhone/headphones cables off my bag, kind of 4/5min under the rain (yeah, I’m living in Lille), to finally hearing my girlfriend saying: “Oops, I have it.” #rage.</p><p>Commuting to my job, I googled some words to find how the remote works: “433MHz”. <em>For the non-advanced ones</em>, it’s a frequency that most of the home automation tools use to communicate. You can buy antenna like RFXCom that can sniff on signals, and repeat them to simulate the device and automate them with a home automation box such as “Home Assistant” or “Domoticz” (there are many more).<br>The thing is, that kind of remote is quite secure (to prevent from guys like you, who want to hack a garage door), and sends rotative signals with the door receiver, that is quite hard to learn and simulate.</p><p>End of the story, start building things. Go to your co-ownership to buy a new remote and start.</p><h4>First idea: simulate “for real” the button pressure</h4><p>The morning I had my new remote control, I didn’t want to break anything on it. From first thoughts, I was thinking about simulating a pressure with a small engine linked to a raspberry: OVERKILL.</p><p>Actually, I looked throughout existing solutions and I discovered <a href="https://prota.info/microbot/push2/">MicroBot Push</a>, a $49.99 wireless robotic button pusher. Honestly, too expensive. Pretty sure it’s a great product, but, paying attention to the WAF, it’s unaffordable (yeah, price and probability that the remote goes out of the MicroBot, or that the button isn’t pressed enough… it’s up to you).</p><h4>Main idea: simulate “from electricity” the button pressure</h4><p><strong>Breaking news</strong>: a button… is… only… a switch.<br><strong>Breaking news 2</strong>: a switch… is… only… a little system that links two electrical circuits (e.g. cables) between them.</p><p>That is to say: if you weld two cables around a button (see figure below), and play by sticking them to each other, it will act as a button pressure: TADA. Isn’t it right?<br>Now, try to imagine that you could programmatically stick those two cables from a relay… it would work as much!</p><p>Here is the tool you need: <a href="https://amzn.to/2s68lWP">NodeMCU (ESP8266)</a>, 1 of those <a href="https://amzn.to/2x454x3">relays</a>, and some cables.<br><strong>Solution</strong>: Thanks to the ESP, you’ll be able to connect to your WiFi network, to open an API and handle requests to open a GPIO pin to open/close the relay, which will be weld around your garage remote button. We can now say: TADA!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x4TDsssq7L2mXgF996Rstw.jpeg" /><figcaption>First step: weld 2 cables around the open button</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9NlcH7Tw-UjCvPWlo_mC-A.jpeg" /><figcaption>Second step: link them to the relay (switch side)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*horwa8WI-tPnz572Kwld0A.jpeg" /><figcaption>Third, and last step: link the relay (controller side) to your ESP8266, from up to bottom, GND, 3.3V, D4 (GPIO 2)</figcaption></figure><p>You can find on <a href="https://github.com/tiste/home-automation/tree/master/garage-door">my GitHub</a> the Arduino project that opens an API on a WiFi network in a /open route.</p><h4>Home Assistant integration</h4><p>I think there can be many solutions to implement a virtual button to call our new ESP API. I personally don’t want to manage a state, as my door automatically closes after some seconds. So I only want to have an action on the “on” action, but nothing on the “off” action.<br>The problem with REST button or other kind of solutions is that you <strong>need to</strong> have a responding call (HTTP 200) in the “off” action.</p><p>Here is the Home Assistant button config:</p><pre>switch:<br>  - platform: command_line<br>    switches:<br>      garage:<br>        command_on: &quot;/usr/bin/curl -X GET <a href="http://esp8266_ip/open">http://ESP8266_IP/open</a>&quot;<br>        command_off: &quot;exit 0&quot;<br>        friendly_name: Garage</pre><p>To handle the button initial state (e.g. “off”), I created an automation script that sets the new button to “off” after 5 seconds.</p><p>You can find the Home Assistant sources in the same repository on <a href="https://github.com/tiste/home-automation/tree/master/garage-door/home-assistant-config">my GitHub</a>.</p><h4>Final words</h4><p>Even if it’s a working solution — that, by the way, can be applied in many circumstances — I sometimes have pain to place the remote in a hidden place while keeping a good distance with the receiver.</p><p>By welding the cables, it allows you to keep your remote functional, without breaking anything. When leaving your flat, just unsolder them, and that’s it.</p><p>I also want to thanks my friend <a href="https://twitter.com/AurelienLoyer">Aurélien</a> for giving me IoT tips, otherwise this article title would have been “Hack your garage door for $50”.</p><p>I’m also listening for feedback, as, like I said, I’m still not a a super duper IoT guy.</p><p>Sources: <a href="https://github.com/tiste/home-automation/tree/master/garage-door">GitHub</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RTQtK0bB9oY6DcQJh21lng.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42146830e147" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Changer son point de vue lors de la création d’apps]]></title>
            <link>https://medium.com/@tiste/changer-son-point-de-vue-lors-de-la-cr%C3%A9ation-dapps-5895fc449fbb?source=rss-84f3a3ee0801------2</link>
            <guid isPermaLink="false">https://medium.com/p/5895fc449fbb</guid>
            <category><![CDATA[reactive-programming]]></category>
            <dc:creator><![CDATA[Baptiste Lecocq]]></dc:creator>
            <pubDate>Wed, 14 Dec 2016 13:06:22 GMT</pubDate>
            <atom:updated>2016-12-14T13:06:22.352Z</atom:updated>
            <content:encoded><![CDATA[<p>En tant que développeurs, ingénieurs, informaticiens (appelez-le comme vous voulez), nous essayons toujours de nous libérer au maximum de la complexité des applications.</p><p>En effet, au fur et à mesure des améliorations, l’architecture et le code deviennent de plus en plus complexes, et ce “tas” passe souvent sous nos coups de refactor… Mais pourquoi développons-nous toujours les applications d’un point de vue concepteur ? Cette complexité n’est-elle pas la conséquence de nos méthodes de développement ?</p><p>Lors de notre passage à dotJS, nous avons eu la chance d’assister au lightning talk de <a href="https://twitter.com/atomrc">Thomas Belin</a>, ce genre d’intervention de 5 minutes qui nous fait penser les choses différemment.<br>Son idée est relativement simple : mettez-vous dans la peau d’un programme, et agissons ensemble, comme le ferait l’ordinateur. Ensuite, réfléchissez à la scène qui est en train de se produire, là, maintenant : vous lisez mon article, et vous êtes certainement en train de regarder ce crayon…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*hogqMr_fVDkWvrl9dEpwFQ.gif" /></figure><p>Si la scène se produisait “en vrai” (je veux dire, physiquement), vous seriez donc en train de souscrire à ce que je dis, et observer ce que je fais. Je serais une fonction du temps, et vous seriez une fonction de ce que je produis.</p><p>Réellement, ce sont des fonctions de votre corps qui répondent à un certain type de message, c’est à dire, “la donnée” :</p><ul><li>vos yeux, au texte ;</li><li>vos oreilles, à ce qui vous entoure…</li></ul><p>Arrivés à ce stade, Thomas nous place face à un fait : ces parties fonctionnelles sont indépendantes les unes des autres, mais elles vous définissent, <strong>vous</strong>.</p><p>Nous nous rendons doucement compte qu’il agit devant nous comme une fonction du temps, mais que les éléments qui nous entourent le font aussi : nos téléphones sont probablement en train de récupérer le dernier tweet, le soleil se couche/se lève et notre fatigue va influer en fonction de ce temps…</p><p>On peut facilement en tirer d’autres exemple, afin de bien comprendre l’idée du talk : placez-vous dans la peau d’un conducteur de voiture. Dans ce cas :</p><ul><li>vous devez faire attention à la route (jusqu’ici, c’est logique),</li><li>des passagers sont susceptibles de vous parler,</li><li>le GPS indique une direction à prendre,</li><li>il est grand temps de passer la 3ème vitesse.</li></ul><p>Les interfaces, comme nous, ont donc plusieurs éléments à prendre en compte : le clic de la souris, la disponibilité d’Internet, le message en temps réel, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*nOX9xWnAfGbvfVy-9AaNOg.gif" /></figure><p>Sans le temps, rien de tout ça n’arriverait. Vous ne recevriez pas d’images, de sons, de mouvements, et vos interfaces ne recevraient aucun signal, aucun message, aucune interaction. La donnée ne serait pas transférée.</p><p>Le temps est donc le facteur commun, et la conception de nos applications doit en dépendre. Le “functional reactive programming” est donc la clé, et les solutions sont nombreuses :</p><ul><li>vue.js</li><li>ReactJS</li><li>RxJs…</li></ul><p>Ces outils nous permettent de concevoir des applications permettant de s’abstraire de “qui reçoit quoi”, “comment il le reçoit”… mais définissant les flux de données et leurs comportements dans la construction de nos interfaces.</p><p>Une autre solution que nous propose <a href="https://twitter.com/atomrc">Thomas</a> dans sa conclusion, est <a href="https://cycle.js.org/">Cycle.js</a>. Les interfaces deviennent ainsi des “pure functions of time”, grâce à une implémentation simple de la lib, légère et sans trop de magie. Sa puissance se ressent lors de la construction de dataflow complexes, où le “functional reactive programming” prend tout son intérêt.</p><p>Vous pouvez retrouver ce lightning talk sur <a href="http://blog.thomasbelin.fr/talks/dotjs-ui-as-pure-functions-of-time/#1">son blog</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5895fc449fbb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sass]]></title>
            <link>https://medium.com/@tiste/sass-eb7ca1e63d65?source=rss-84f3a3ee0801------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb7ca1e63d65</guid>
            <category><![CDATA[sass]]></category>
            <dc:creator><![CDATA[Baptiste Lecocq]]></dc:creator>
            <pubDate>Wed, 14 Dec 2016 09:21:31 GMT</pubDate>
            <atom:updated>2016-12-14T13:02:26.019Z</atom:updated>
            <content:encoded><![CDATA[<p>Sass, ce langage permettant une grosse évolution du CSS par l’ajout de variables, de fonctions, d’héritages… se montre de plus en plus dans le monde du web.</p><p>Cet article sera évolutif et traitera principalement des parties magiques de Sass (la <a href="http://sass-lang.com/guide">documentation</a> étant déjà très complète).</p><h3>Pour la petite histoire</h3><p>Sass est un préprocesseur CSS, c’est à dire qu’il transforme un langage en l’étendant, pour générer du code CSS final.</p><p>Il existe deux familles de pré-processeur CSS :</p><ul><li>Less</li><li>Sass : SCSS (principalement utilisé), SASS (utilisé surtout dans le monde Ruby)</li></ul><p>Voyons rapidement deux bouts de codes :</p><pre>body<br>  background-color: #FEFEFE<br>  color: invert(#FEFEFE)</pre><pre>body {<br>  background-color: #FEFEFE;<br>  color: invert(#FEFEFE);<br>}</pre><p>La différence majeure, se joue principalement sur la syntaxe, le SCSS a une ressemblance plus proche au CSS alors que Sass se permet d’enlever les ; et les accolades.</p><h3>La magie de Sass</h3><h4>L’interpolation avec Bootstrap</h4><p>N’étant pas designer, j’utilise souvent <a href="http://getbootstrap.com/">Bootstrap</a> (et <a href="http://foundation.zurb.com/">Foundation</a>).</p><blockquote><em>Bootstrap utilise le Less alors que Foundation préfère le Sass. Néanmoins, un repo Github permet la portabilité de </em><a href="https://github.com/twbs/bootstrap-sass"><em>Bootstrap vers Sass</em></a><em>.</em></blockquote><p>Pour les points suivants, importez bootstrap-sass en gem ou sur Compass.</p><h4>Créer des boutons flats</h4><p>Avec une période où les 3/4 des sites tentent de faire du flat design, je suis parti à la recherche d’un type de boutons de ce style.</p><p>L’idée est de garder le border-color initial, de passer le background-color au transparent, le color au background-color initial et, lors du hover, repasser le background-color à sa valeur initiale.</p><p>Je me suis donc créé une classe btn-inverse qui pourrait fonctionner directement en la couplant à la class btn standard de Bootstrap.</p><pre>.btn-inverse<br>  background-color: transparent<br><br>  &amp;.btn-primary<br>    color: darken($brand-primary, 5%)<br><br>    &amp;:hover<br>      color: $btn-primary-color<br><br>  &amp;.btn-success<br>    color: darken($brand-success, 5%)<br><br>    &amp;:hover<br>      color: $btn-success-color</pre><p><strong>Expliquons :</strong></p><p>Bootstrap possède des couleurs par défaut représentées sous ces variables $brand-primary, $brand-success, $brand-warning, etc... Il suffit donc de les reprendre afin de garder un thème uniforme.</p><p>Passons à deux syntaxes qui peuvent vous paraître étrange :</p><ul><li>Le “nested” : imbriquer des classes afin d’hériter de leur comportement</li><li>Le &amp; : reprend le nom de classe parent</li></ul><p>Ainsi, si une div possède les classes btn, btn-primary et btn-inverse votre bouton sera plutôt (swag) élégant.</p><h4>Créer des classes dynamiques de couleurs (avancé)</h4><p>Un autre point sur lequel je m’embêtait souvent, est le nom de classes associés à des couleurs (background-color et color) afin de rester le plus généraliste possible.</p><p>Sass fourni en plus des fonctions, du nested, etc… un système de boucles (while, for, each).</p><p>L’idée est de créer des variables de couleurs, de boucler sur chacune d’elle en reprenant la valeur associé ainsi que le nom. De plus, créons une liste de ces variables.</p><pre>$green:  #1abc9c<br>$blue:   #3498db<br>$orange: #f39c12<br><br>$colors: green, blue, orange</pre><h4>La théorie</h4><p>Nous pourrions très bien faire quelque chose de ce genre :</p><pre>@each $color in $colors<br>  .#{$color}<br>    background-color: $color</pre><p>En effet, une classe se nommant green pourrait avoir une propriété background-color: #1abc9c car, comme en Ruby, #{} permet l&#39;interpolation de variables.</p><p>Or, dans une boucle, Sass n’est pas capable de gérer cette mise en pratique (il s’agit d’une de ces limites).</p><h4>La pratique</h4><p>Il est donc possible de gérer ce cas en créant une liste de tableaux, l’un important le nom, l’autre la valeur.</p><p>Mettons à jour notre liste $colors :</p><pre>$colors: green $green, blue $blue, orange $orange</pre><blockquote><em>Pour sélectionner une valeur dans un tableau, </em><em>nth(array, 2) selectionnera le deuxième item du tableau</em></blockquote><pre>@each $color in $colors<br>  .#{nth($color, 1)}<br>    background-color: nth($color, 2)</pre><h4>Amélioration des classes</h4><p>Il est parfaitement possible d’améliorer ces classes, par exemple en détectant l’obscurité du background-color afin de gérer la couleur du texte.</p><p>De plus, pourquoi ne pas générer à la volée des classes type text-blue afin de gérer la couleur du texte, sans pour autant modifier le background-color.</p><pre>@each $color in $colors<br>  .#{nth($color, 1)}<br>    background-color: nth($color, 2)<br><br>    @if lightness(nth($color, 2)) &gt; 80%<br>      color: #333<br>    @else<br>      color: #FEFEFE<br><br>  .text-#{nth($color, 1)}<br>    color: nth($color, 2)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb7ca1e63d65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sites statiques : Github, Middleman et Jekyll]]></title>
            <link>https://medium.com/@tiste/sites-statiques-github-middleman-et-jekyll-ca07f3941372?source=rss-84f3a3ee0801------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca07f3941372</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[static-site]]></category>
            <category><![CDATA[middleman]]></category>
            <category><![CDATA[jekyll]]></category>
            <dc:creator><![CDATA[Baptiste Lecocq]]></dc:creator>
            <pubDate>Wed, 14 Dec 2016 09:15:20 GMT</pubDate>
            <atom:updated>2016-12-14T13:03:59.393Z</atom:updated>
            <content:encoded><![CDATA[<p>Souvenez-vous des sites personnels avec livre d’or, commentaires, statistiques en tous genres, écrits en bon vieux HTML/PHP, hébergés sur un mutu 1&amp;1 Starter 2€99, balancés sur la toile en FTP avec l’espoir que la base MySQL est bien paramétrée… J’en passe des meilleures.</p><p>Ce temps est révolu, concentrez vous sur le contenu ! Actuellement, la majorité des actions sur un blog/application sont le “bookmark” ou le “précédent”.</p><blockquote><em>Néanmoins, ces technos ne sont pas à bannir, elles restent tout de même la base d’une bonne compréhension web.</em></blockquote><p>A présent, entrons dans le vif du sujet : vous souhaitez vous créer un site personnel ? Un site présentant votre Facebook fait maison ? Cet article est fait pour vous !</p><h3>User/project Github pages</h3><p>Github : c’est un service web d’hébergement et de gestion de développement de logiciels, utilisant le programme Git <em>(merci Wikipédia)</em>… Pour faire court : <strong>une plateforme sociale de travail</strong>. Ce réseau offre d’innombrables solutions permettant le développement de communautés souhaitant collaborer au sein d’un environnement stable et agréable.</p><p>Restons focalisés sur le thème de cet article. L’une de ces fonctionnalités est le “user/project Github pages”, comprenez “pages Github d’utilisateur/projet”.</p><p>Après la création de votre compte Github, vous aurez la possibilité de démarrer une infinité de projets (appelés “repository”).</p><blockquote><em>Où veux-tu en venir ? Tu travailles pour Github ?</em></blockquote><p>Eh non, mais pour chacun des dossiers créés, un domaine web est réservé pour la mise en place d’un site de présentation du projet, intéressant non ?</p><p><strong>Exemple</strong> : my-awesome-plugin créé par moi-même (tiste), donnerait l&#39;url suivante : <a href="http://tiste.github.io/my-awesome-plugin">http://tiste.github.io/my-awesome-plugin</a></p><h4>La technique</h4><p>Commençons par un projet banal.</p><p>Admettons que votre code soit versionné. Il utilisera les branches master, develop, etc.</p><p>Afin de construire votre “project github pages”, vous n’aurez qu’à pousser du code basique style : HTML, CSS, Javascript... sur une branche nommée <strong>gh-pages</strong>.</p><p>Le rendu sera disponible d’ici une dizaines de minutes sur <a href="http://username.github.io/projectname">http://username.github.io/projectname</a></p><blockquote><em>Mais qu’est ce qu’un “user Github pages” ?</em></blockquote><p>Le principe est le même, à deux différences près :</p><ul><li>le dossier doit prendre la forme de : username.github.io</li><li>le code source doit être sur la branche master</li></ul><p>L’intérêt de ce dossier est de posséder votre site personnel sur une adresse du type : http://username.github.io Ainsi, vous mêlez projets et site de présentation sur une même base URL.</p><h4>Je veux changer d’URL</h4><p>En effet, d’un point de vue communication, il est étrange de donner une adresse Github pour un site web (quoique…).</p><p>Il existe donc un agencement de méthodes assez simple :</p><ol><li>déposer un CNAME à la racine de vos sources avec l’url souhaitée comme seul contenu</li><li>faire pointer les DNS sur Github (explication à la suite)</li></ol><p>Si votre URL ne possède pas de sous-domaine, créez une entrée A pointant vers l&#39;ip 204.232.175.78.</p><p>Sinon, créez une entrée CNAME dirigeant vers votre url Github.io, soit : username.github.io.</p><p>Voyons maintenant divers outils les plus utilisés dans la conception de sites hébergés chez Github.</p><h3>Outils</h3><h4>Github’s Automatic Page Generator</h4><p>Le premier de ces outils est bien évidemment livré par Github.</p><p>Allez dans l’onglet “Settings” de votre dossier Github, et cliquez sur le bouton “Automatic Page Generator”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/0*FkRVUHLudFECWT2n.png" /></figure><p>Vous aurez accès à l’écriture de votre contenu ainsi qu’une sélection de thèmes. Les sources seront incluses dans votre dossier sur la branche gh-pages.</p><p><strong>Astuce</strong> : rédigez au préalable un README.md et Github le prendra comme contenu par défaut.</p><h4>Middleman</h4><p>Pour moi l’un des meilleurs générateur de sites statiques, <a href="http://middlemanapp.com/">Middleman</a> est écrit et se développe en ruby.</p><p>Cette gem crée une architecture ressemblant à celle de <a href="http://rubyonrails.org/">Ruby On Rails</a>.</p><p>L’avantage de ce générateur est qu’il est en parfaite interaction avec Ruby et donc, les gems (une gem est un assortiment de fichier de code, permettant un développement plus rapide de certaines fonctionnalités). Ajoutez donc les gems souhaitées au Gemfile, et utilisez les dans votre code.</p><p><strong>Exemple</strong> : slim, sass, coffeescript...</p><p>Son principe est simple, l’ensemble du code se situe dans le dossier source et il se compile dans le dossier data. Pour lancer le serveur middleman : middleman server (accessible sur localhost:4567).</p><p>Vous l’aurez compris, Github a besoin de la version compilée de Middleman. Le principe est simple :</p><ul><li>Créez une branche master contenant vos sources</li><li>Créez une branche orpheline gh-pages contenant le site compilé</li></ul><blockquote><em>Tu m’as perdu ! C’est beaucoup trop dur à gérer !</em></blockquote><p>Heureusement, pour les plus novices d’entre vous, la gem middleman-deploy fera ce travail. Vous n&#39;aurez que l&#39;architecture et le contenu à penser.</p><p>Voici une brève installation de middleman.</p><pre>gem install middleman # si vous ne la possédez pas encore<br>middleman init my_awesome_project --template=html5</pre><pre># Gemfile<br><br>gem &#39;middleman&#39;,            &#39;~&gt; 3.1.3&#39;<br>gem &#39;middleman-deploy&#39;<br>gem &#39;middleman-livereload&#39;, &#39;~&gt; 3.1.0&#39;<br>gem &#39;middleman-syntax&#39;<br>gem &#39;redcarpet&#39;<br>gem &#39;slim&#39;</pre><pre># config.rb<br><br>activate :gzip<br>activate :livereload<br>activate :syntax<br><br>set :markdown, fenced_code_blocks: true<br>set :markdown_engine, :redcarpet<br><br>configure :build do<br>  activate :minify_css<br>  activate :minify_javascript<br>end<br><br>activate :deploy do |deploy|<br>  deploy.method       = :git<br>  deploy.branch       = &#39;master&#39;<br>  deploy.build_before = true<br>end</pre><p><strong>Ressources utiles</strong> :</p><ul><li><a href="http://middlemanapp.com/basics/getting-started/">Documentation Middleman</a></li><li><a href="http://www.alpine-lab.com/blog/middleman-le-generateur-de-sites-statiques-pas-a-pas/">Article Alpine-Lab</a></li></ul><h4>Jekyll</h4><p>Avec un esprit “blog” plus important, Jekyll est <strong>L’</strong>outil pour gérer votre contenu de manière très simple.</p><p>Celui-ci est composé de la structure suivante :</p><ul><li>_posts/ : les articles</li><li>_includes/ : les parties globales du site (header, footer, etc...)</li><li>config.yml : configuration générale</li><li>_site : placé dans le .gitignore, ce dossier représente votre site compilé (disponible après le premier lancement du serveur, voir plus bas)</li><li>_layouts/ : modèles utilisés dans un post, une page, etc... Il suffit de le préciser dans les données de cette page</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/0*L3rAKBgBBT8gsJGi.png" /></figure><p>Il vous sera donc possible de gérer une pagination, d’installer des <a href="http://jekyllrb.com/docs/plugins/">plugins et gems</a>, des permaliens…</p><p>Afin d’avoir un meilleur jugement concernant sa simplicité, voici la <a href="http://jekyllrb.com/">documentation Jekyll</a>.</p><p>Au niveau du déploiement, Github prend complètement en charge sa compilation. En effet, lors du développement, la commande permettant l’affichage du site et sa compilation est : jekyll serve (accessible sur localhost:4000). Lors de la production, Github va automatiquement détecter chacun de vos push, et compilera automatiquement votre application.</p><p><strong>Note</strong> : veillez à développer votre application sur la branche gh-pages ou master (dans le cas respectivement d&#39;un dossier de projet, ie. project Github pages, ou de votre dossier personnel, ie. user Github pages).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca07f3941372" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Versionner ? Pourquoi et comment avec Git !]]></title>
            <link>https://medium.com/@tiste/versionner-pourquoi-et-comment-avec-git-41b3717c2409?source=rss-84f3a3ee0801------2</link>
            <guid isPermaLink="false">https://medium.com/p/41b3717c2409</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[tips]]></category>
            <dc:creator><![CDATA[Baptiste Lecocq]]></dc:creator>
            <pubDate>Tue, 13 Dec 2016 15:03:57 GMT</pubDate>
            <atom:updated>2016-12-13T15:03:57.911Z</atom:updated>
            <content:encoded><![CDATA[<p>Git est un VCS (Version Control System). Il s’agit d’un outil vous permettant la gestion et le suivi du code. En effet, le versionning de vos fichiers (pouvoir suivre l’avancement d’un fichier dans le temps) et le travail en équipe, peut être parfois assez laborieux. Git vous simplifiera la vie.</p><h3>Comprendre Git</h3><p>Git possède une architecture et une organisation spéciale, en comparaison aux autres VCS (SVN, Mercurial, etc…).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*gpZxo01tqYZlaneC.png" /></figure><p>Concernant l’architecture, trois zones (trees) de base sont à votre disposition : <strong>Working Directory</strong>, <strong>Index</strong>, <strong>HEAD</strong>. La première représente votre dossier courant. La seconde, la zone de staging (un fichier retenu dans un état). Le dernier représente la validation (le commit), c’est à dire une version à l’instant t de vos fichiers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*hzAjaw5SmWJKACj3.png" /></figure><h3>Démarrer un projet Git</h3><pre>git init</pre><p>Lors de la création de votre projet git, aucun des fichiers n’est versionné. On dit que les fichiers sont “untracked”.</p><p>Puis vient l’état “unmodified” qui représente un fichier placé sous versionning mais non modifié (le fichier possède au moins un commit). Pour arriver à cette étape de fichier versionné, il suffit de lancer la commande git add filename (on peut remplacer le nom du fichier par . ce qui les représente tous), puis git commit -m &quot;Some text&quot;.</p><p>Dès les premières modifications, Git saura qu’il y a eu une évolution et le fichier sera considéré comme “modified”. Il ne vous restera plus qu’à le “stage” (passer du Working directory à la zone d’Index), puis de le commit, ce qui le fera retourner dans un état “unmodified”.</p><p>Vous l’aurez compris, Git ne se limite pas qu’à cela, il s’agit d’un exemple très banal et surtout, local.</p><h3>Les commandes de base</h3><pre>git add .</pre><p>Ajoute les fichiers modifiés (du Working directory) dans la zone d’index (le stage)</p><pre>git commit -m &quot;A brief message regarding the present commit&quot;</pre><p>Valide les modifications des fichiers (présent dans la zone d’index)</p><pre>git log</pre><p>Permet de voir tous les commit effectués (complété avec --pretty et --graph, vous aurez un beau visuel)</p><pre>git status</pre><p>Affiche l’état actuel des fichiers</p><pre>git rm filename</pre><p>Supprime un fichier du repo git</p><p>Supprimer un fichier à la main ne le supprimera pas pour les futurs commit. C’est pour cela qu’avant de faire un git commit, il est préférable de regarder si le fichier est bien supprimé. <strong>Remarque</strong> : le fichier sera toujours disponible pour les commit antérieurs.</p><pre>git diff</pre><p>Affiche les modifications effectuées mais pas encore “on stage”. L’ajout de l’option --cached vous montrera les différences entre les fichiers &quot;on stage&quot; et le dernier commit.</p><h3>Les branches</h3><pre>git branch branchname</pre><p>Crée une branche.</p><pre>git checkout -b branchname</pre><p>Crée une branche et vous y positionne.</p><p>Je vous ai parlé de “trees” tout à l’heure ? Voyons donc les “branch”.</p><p>Une branche est utilisée pour pouvoir travailler sur différentes partie du code (différentes features). Celles-ci sont simples d’utilisation car (contrairement à d’autres VCS), elles ne copient pas tous le code. Une branche est juste un pointeur qui se déplace sur vos commit.</p><p>Prenons un cas concret d’utilisation de branche : vous devez créer un site pour un magasin de cosmétiques. Tout s’est bien déroulé et vous allez passer à la création du livre d’or en codant à de multiples endroits. Malheureusement, il n’est d’aucune utilité et il faut le supprimer. Si vous n’avez pas pensé aux branches… bon courage. Sinon, une suppression de la branche vous fera passer à l’instantané souhaité (le pointeur de la branche sera juste supprimé).</p><blockquote><em>L’homme descend du singe</em></blockquote><p>En effet, vous pouvez sauter de branche en branche afin d’améliorer certaines features pour ensuite les rassembler sur vos branches.</p><h4>Le merging</h4><pre>git merge branchname</pre><p>Fusionne la branchname sur la branche courante</p><pre>git pull origin branchname</pre><p>Fusionne la branchname sur la branche courante, en récuperant le code distant au préalable <em>nous verrons les dépots distants plus bas.</em></p><p>Il est très facile d’utiliser les branches… Mais comment les rassembler ? L’idée est de se positionner sur la branche sur laquelle vous souhaitez fusionner : git checkout branchname (checkout sert à se déplacer — ajoutez l&#39;option -b et git vous créera une branche), puis de merger.</p><h4>Un peu plus sur le merging</h4><p>Si vous vous sentez confiant, lisez ceci.</p><p>Le merging est plus complexe que précédemment cité. En effet, de base, git se repère grâce à trois choses : l’ancêtre commun et les deux derniers commit des branches à merger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*njBJbNnNDH6hxfQL.png" /></figure><p>Lors de votre merge, git regarde si l’ancêtre du commit de la branche à fusionner est direct en comparaison au commit de votre branche attendant la fusion.</p><ul><li>Si le commit est direct, il utilisera l’avance rapide (fast-forward). Prenons l’exemple du schéma en faisant abstraction du C5. Le fast-forward décalera le pointeur situé sur C2, vers C4. C4 possédera donc les changements de C3.</li><li>Si non, git créera un commit de fusion entre C4 et C5 (en reprenant le schema au complet).</li></ul><p><strong>Remarque</strong> : l’utilisation d’un git merge --no-ff oblige git à créer un commit de fusion. Cette option est très intéressante car nous pouvons toujours avoir un visuel des branches fusionnées. Avec fast-forward, ceci est plus délicat.</p><h4>Suivre le Gitflow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KA83DDKmpxqGe87y.png" /><figcaption>Gitflow</figcaption></figure><p>Gitflow est une architecture de branches, qui est fortement conseillée lors de la création/gestion de projet.</p><p>D’un aspect synthétique, la branche master n’est utilisée que pour les releases de production (les versions majeures). Develop pour les releases mineures. Et chacune des fonctionnalité développée sera sur une “feature branch” (ex : feature/contact_form).</p><p>D’un point de vue technique, develop sera fusionnée sur master à chaque version majeure. De plus, chaque feature sera créée à partir de develop et fusionnée sur cette dernière. Quand une feature est terminée, il est conseillé de supprimer cette branche.</p><h3>Les tags</h3><p>Des troncs, des branches… voici les feuilles… (?)</p><p>Les tags représentent des annotations concernant les versions de votre projet.</p><pre>git tag v0.1</pre><p>Crée un tag sur le commit actuel</p><pre>git tag v0.1 e285d87</pre><p>Crée un tag sur le commit de SHA e285d87</p><pre>git show v0.1</pre><p>Donne les informations du commit sur lequel le tag v0.1 se trouve</p><h3>La gestion d’erreurs</h3><p>Eh oui, le monde git n’est pas sans petits accros. Nous allons voir brièvement quelques aides.</p><h4>Une fusion avec conflit</h4><p>Rien de grave, git a prévu des sections dans les fichiers à conflits.</p><pre>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD:index.html<br>Voici du contenu<br>=======<br>Here is some content<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; feature/english:index.html</pre><p>La première partie représente la branche sur laquelle vous êtes positionné, la deuxième est la branche à fusionner. Il ne reste qu’à enlever les sections, de faire un choix et de git add index.html pour marquer le fichier résolu. Une fois tous les conflits résolus, un git commit fera l&#39;affaire.</p><h4>Réinitialiser un fichier modifié</h4><pre>git checkout -- filename</pre><h4>Réinitialiser un fichier modifié en phase d’indexation (stage)</h4><pre>git reset HEAD filename</pre><h4>Un commit trop rapide</h4><pre>git commit --amend</pre><p>Il est conseillé de commit correctement et proprement. Pas besoin d’un commit à chaque ligne de code. Par soucis de perfection, vous serez peut être amenés à ajouter quelques modifications de dernière minute à un commit déjà effectué. Il est possible de le faire, sur le dernier commit réalisé.</p><h3>Les remotes</h3><p>Travailler seul c’est bien. A plusieurs c’est mieux.</p><h4>Du local vers la remote</h4><pre>git add remote origin url</pre><p>Créé la remote de nom “origin” et d’url “url”</p><pre>git push origin master</pre><p>Pousse les modifications de la branche master vers la branche master de la remote origin</p><p>En effet, il existe une étape par rapport au local, le push. Celui-ci sert à envoyer les données vers le serveur. Admettons la création d’un repository vide Github. Il vous suffira d’ajouter la remote avec la bonne url, et de push. Les modifications s’y situeront.</p><h4>Du remote vers le local</h4><pre>git clone url</pre><p>Clone le repository (si vous n’avez pas encore récupéré les fichiers de la remote)</p><pre>git fetch</pre><p>Amène les commit de toutes les remote sur votre local</p><pre>git pull<br># = git fetch + git merge</pre><p>La distinction entre ces deux dernières commandes n’est pas toujours évidente. Fetch ne fera que “tirer” les modifications sur votre local alors que pull les mergera sur vos branches. <strong>Remarque</strong> : il est préférable d’utiliser un git pull --rebase qui vous évitera une salve de possibles conflits.</p><h4>Les commandes de base</h4><pre>git remote -v</pre><p>Affiche le nom et l’url de votre remote</p><pre>git remote show origin</pre><p>Affiche les informations de la remote origin</p><h3>Don’t try this</h3><p>Une fois le code poussé sur le serveur, deux méthodes sont à proscrire sous peine de… conflits techniques et sociaux. Ne jamais rebase et commit --amend un code utilisé en remote. En effet, les commit sont tous reliés à leurs parents grâce au SHA (l&#39;identifiant du commit). Effectuer l&#39;une de ces deux commandes change le SHA du commit et donc, même si tout vas bien sur votre local, s&#39;en est tout autre pour vos collègues.</p><p><strong>Liens utiles</strong> : <a href="http://git-scm.com/book/fr">Git book</a>, <a href="http://geekographie.maieul.net/IMG/pdf/progit.fr.pdf">Pro Git</a>, <a href="http://nvie.com/posts/a-successful-git-branching-model">Gitflow</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41b3717c2409" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>