<?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 Marcos Cannabrava on Medium]]></title>
        <description><![CDATA[Stories by Marcos Cannabrava on Medium]]></description>
        <link>https://medium.com/@marcoscannabrava?source=rss-fa7cbcfbe43e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gc2oPfJ52Tp9nCdqse9lFw.jpeg</url>
            <title>Stories by Marcos Cannabrava on Medium</title>
            <link>https://medium.com/@marcoscannabrava?source=rss-fa7cbcfbe43e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 11:10:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marcoscannabrava/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[Summary: Hard Thing About Hard Things]]></title>
            <link>https://medium.com/@marcoscannabrava/summary-hard-thing-about-hard-things-3805dd9a106?source=rss-fa7cbcfbe43e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3805dd9a106</guid>
            <category><![CDATA[founders]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[management]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Marcos Cannabrava]]></dc:creator>
            <pubDate>Mon, 15 Jun 2020 23:06:55 GMT</pubDate>
            <atom:updated>2020-06-15T23:10:06.299Z</atom:updated>
            <content:encoded><![CDATA[<h3>Summary: Hard Thing About Hard Things (Ben Horowitz)</h3><h3>Table of Contents</h3><ul><li><a href="#6062">During “The Struggle”</a></li><li><a href="#9bce">How to lay off employees the right way</a></li><li><a href="#70ae">“We take care of the people, the products, and the profits — in that order.”</a></li><li><a href="#7f56">Why you should train your people</a></li><li><a href="#d33f">What to look for when screening executive candidates</a></li><li><a href="#01c1">Common management debt sources</a></li><li><a href="#8efd">List of questions great HR organization can answer</a></li><li><a href="#4085">Keeping politics out</a></li><li><a href="#a74d">One-on-ones</a></li><li><a href="#e931">Steps to the organizational design</a></li><li><a href="#9698">Calming nerves</a></li><li><a href="#1db0">3 traits of a leader</a></li><li>Most business relationships either become too tense to tolerate or not tense enough to be productive after a while</li><li>Most important rule of raising money privately: look for market of one</li><li>You need 2 types of friends: person who will be over the moon excited when good things happen, and those you can rely on when life is on the line and you have one call</li><li>“If you’re going to eat shit, don’t nibble”</li><li>Ask yourself “what am I not doing [/providing]?”</li><li>When you are building a company, you must believe there is an answer and you cannot pay attention to your odds of finding it. You just have to find it.</li></ul><h3>During “The Struggle”</h3><ul><li>Don’t put it all on your shoulders</li><li>This is not checkers, this is motherfuckin’ chess</li><li>Play long enough and you might get lucky</li><li>Don’t take it personally</li><li>Remember that this is what separates the women from the girls</li></ul><h4>Tell it like it is, because:</h4><ul><li>Trust: without trust, communication breaks</li><li>The more brains working on hard problems, the better</li><li>Bad news travels fast; good news travels slow.</li></ul><h3>How to lay off employees the right way</h3><ul><li>Get your head right</li><li>Don’t delay</li><li>Be clear in your own mind about why you are laying people off</li><li>Train your managers: they need to lay off their own people</li></ul><pre>- Explain what happened and company, not personal failure<br>- They should be clear: employee impacted and non-negotiable<br>- Fully prepped with details about benefits and support</pre><ul><li>Address the entire company (before layoffs and message is for those who are staying)</li><li>Be visible, be present</li></ul><h4>Firing an executive:</h4><ul><li>Root cause analysis</li><li>Inform the board</li><li>Prepare for conversation</li><li>Preparing company communication</li></ul><pre>- Once you make the decision, consider 2 deep emotions: Embarrassment and betrayal<br>- Keys to being fair and honest in this situation (p. 68):<br>  - Use appropriate language<br>  - Admit reality<br>  - Acknowledge the contributions</pre><ul><li>“There may be nothing scarier in business than facing an existential threat. So scary that many in the organization will do everything to avoid facing it. They will look for any alternative, any way out, any excuse not to live or die in a single battle.”</li><li>“If our company isn’t good enough to win, then do we need to exist at all?”</li><li>“I don’t give a fuck how well-trained you are. If you don’t bring me $500K a quarter, I’m putting a bullet in your head.”</li></ul><h3>“We take care of the people, the products, and the profits — in that order.”</h3><h3>Why you should train your people</h3><ul><li>Productivity</li><li>Performance management</li><li>Product quality</li><li>Retention of employee</li></ul><p>Implementing training: Needs to be mandatory.</p><ul><li>“If you would be shocked and horrified if company X hired several of your employees, then you should not hire any of theirs”</li></ul><h3>What to look for when screening executive candidates</h3><h4>What will you do in your first month on the job?</h4><ul><li>Beware of answers that overemphasize learning (startups aren’t as complex as big companies)</li><li>Beware of interrupt-driven execs vs pace-setters (interruptions won’t come in a startup)</li><li>Look for candidates who’ll come in with more initiatives than you thought possible.</li></ul><h4>How will your new job differ from your current role?</h4><ul><li>Look for articulate candidates.</li><li>Beware of those who think much of what they know is immediately transferable.</li></ul><h4>Why do you want to join a small company?</h4><ul><li>Beware of equity as primary motivation. 1% of nothing is nothing.</li><li>Look for those who want to be creative. Creating vs Running is the big difference between a big company and a small company.</li></ul><p>Managing strictly by numbers is like painting by numbers — strictly for amateurs</p><h3>Common management debt sources</h3><ul><li>Putting two in the box</li><li>Overcompensating key employee because she gets another job offer</li><li>No performance management or employee feedback process</li><li>“Every really good, really experienced CEO I know shares 1 important characteristic: they tend to opt for the hard answer to organizational issues”</li></ul><h3>List of questions great HR organization can answer</h3><h4>Recruiting and Hiring</h4><ul><li>Skills and talents required to succeed in each position</li><li>Prepare the interviewers</li><li>Ensure managers and employees know how to sell the company to prospective employees</li><li>Ensure interviewers arrive on time</li><li>Ensure managers/recruiters follow up on candidates in a timely fashion</li><li>Ensure you compete effectively for talent against the best companies</li></ul><h4>Compensation</h4><ul><li>Do benefits make sense for the companies’ demographic?</li><li>How does the compensation compare to other companies’?</li><li>How well do performance rankings correspond to compensation practices?</li></ul><h4>Training and Integration</h4><ul><li>How long does it take for newcomers to become productive?</li><li>How well do newcomers understand what’s expected of them?</li></ul><h4>Performance Management</h4><ul><li>Ensure managers give consistent, clear feedback</li><li>Ensure quality/process of company’s written performance reviews</li></ul><h4>Motivation</h4><ul><li>Ensure motivation</li><li>Reduce attrition</li></ul><h3>Keeping politics out</h3><ul><li>Hire people with right kind of ambition (for company success)</li><li>Build strict processes for potentially political issues and do not deviate</li><li>Peter principle: in a hierarchy, members are promoted so long as they work competently; sooner or later they will become incompetent</li><li>Law of Crappy People: for any title level in a large organization, the talent on that level will eventually converge to the crappiest person with that title</li></ul><h3>One-on-Ones</h3><p>It’s the employees meeting: have them set the agenda</p><p>For more introverted employees, some good questions:</p><ul><li>If we could improve in any way, how would we do it?</li><li>What’s the number one problem here?</li><li>What’s not fun about working here?</li><li>Who do you admire in the company?</li><li>What changes would you make?</li><li>What don’t you like about the product?</li><li>What’s the biggest opportunity we’re missing out?</li><li>What are we not doing that we should be doing?</li><li>Are you happy working here?</li></ul><p>Go for shock when designing culture</p><p>Perks are not culture; they don’t establish a core value that drives the business and helps promote it in perpetuity</p><h3>Steps to the organizational design</h3><ul><li>What needs to be communicated?</li><li>What needs to be decided?</li><li>Prioritize the most important communication and decision paths</li><li>Decide who’s going to run each group</li><li>Identify the paths you didn’t optimize and build a plan for mitigating those issues</li><li>“Managing at scale is a learned skill rather than a natural ability”</li></ul><h3>Calming nerves</h3><ul><li>make friends,</li><li>get it on paper,</li><li>focus on the road (not the wall)</li><li>Someone needs to be in charge (one person)</li><li>Courage, like character, can be developed</li><li>2 skills to run organization: knowing what to do, getting company do to what you know</li><li>Measure of quality of leader: quantity, quality and diversity of people who want to follow her</li></ul><h3>3 traits of leader</h3><ol><li>Ability to articular the vision</li><li>Right kind of ambition</li><li>Ability to achieve the vision</li></ol><h4>Peacetime vs Wartime CEO</h4><ul><li>Feedback is a dialogue: Give an opinion on everything — will get company used to it</li><li>“In good companies, the story and the strategy are the same thing”</li></ul><p>*read Jeff Bezos letter to shareholders in ‘97</p><p>*check out Reed Hasting’s “Reference Guide on Our Freedom &amp; Responsibility Culture”</p><ul><li>“Show it, sell it; hide it, keep it”</li><li>“…the most important lesson in entrepreneurship: embrace the struggle”</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3805dd9a106" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Summary: Execution (Ram Charam)]]></title>
            <link>https://medium.com/@marcoscannabrava/summary-execution-ram-charam-40eaf8efe068?source=rss-fa7cbcfbe43e------2</link>
            <guid isPermaLink="false">https://medium.com/p/40eaf8efe068</guid>
            <category><![CDATA[management]]></category>
            <category><![CDATA[operations]]></category>
            <category><![CDATA[leadership]]></category>
            <dc:creator><![CDATA[Marcos Cannabrava]]></dc:creator>
            <pubDate>Mon, 15 Jun 2020 22:49:32 GMT</pubDate>
            <atom:updated>2020-06-15T22:52:32.859Z</atom:updated>
            <content:encoded><![CDATA[<h3>Table of Contents</h3><ul><li><a href="#74a4">Execution</a></li><li><a href="#3ad3">7 building blocks of execution</a></li><li><a href="#81ef">Framework for cultural change</a></li><li><a href="#f883">Reasons for people-roles mismatch</a></li><li><a href="#0976">The Core Processes of Execution</a></li><li><a href="#d315">Operations Process</a></li></ul><h3>Execution</h3><blockquote>“A systematic process of rigorously discussing the hows &amp; whats, questioning, tenaciously following through and ensuring accountability.” (discipline, leader’s major job, culture’s core element)</blockquote><h3>7 building blocks of execution</h3><h4>Know the people and the business</h4><p>Know the fundamentals (revenue/profit/mkt.share drivers, competition, markets, customers, critical issues), past/present accomplishments, ambition drivers, future job requirements (skills &amp; behaviors), be present</p><h4>Insist on realism</h4><p>Informal dialogue, org’s capabilities, strengths, weaknesses, can it execute the strategy?, budget plan x op. plan, question weakest assumptions</p><h4>Set clear goals and priorities</h4><p>Few priorities, simple/direct, 80/20, vision breakdown</p><h4>Follow through</h4><p>Summarize CTA, 5w2h, milestones</p><h4>Reward the doers</h4><p>Performance (= what they achieved and how) =&gt; reward</p><h4>Expand people’s capabilities</h4><p>Development around issues facing the company</p><h4>Know yourself</h4><p>Authenticity, self-awareness, self-mastery, humility</p><h3>Framework for cultural change</h3><p>Hardware (strategy/structure) + Software (beliefs/behaviors)</p><ol><li>Communicate what you want</li><li>Get others involved in planning</li><li>Reward those who help make the change a reality</li></ol><h3>Reasons for people-roles mismatch</h3><p>Lack of knowledge, lack of courage, psychological comfort factor, lack of personal commitment / People you’re looking for energize people, are decisive on tough issues, follow through, get things done through others</p><h3>The Core Processes of Execution</h3><h4>People Process</h4><p>(evaluate, framework to identify/develop leadership talent, leadership pipeline)</p><ul><li>Evaluate (enthusiasm for execution, qualities, ethic, inclusive, energy, results)</li><li>Framework to identify/develop leadership talent (skills set x behavior, highlights, low points, challenges, strengths, develop.needs, develop.plan, next moves)</li><li>Fill the leadership pipeline (continuous improvement, succession depth analysis, retention risk)</li></ul><h4>Strategy Process</h4><p>(What do we want to accomplish and How)</p><p><strong>Questions:</strong></p><ul><li>What’s the assessment of the external environment?</li><li>How well do you understand customers?</li><li>Who is the competition?</li><li>Short-term vs. long-term balance?</li><li>Critical issues facing the business?</li><li>What are the milestones?</li><li>Can the business execute the strategy?</li><li>What will drive revenue on a sustainable basis?</li><li>How to grow profits? What are the obstacles?</li></ul><p><strong>Strategy Review</strong></p><ul><li>Creative exercise to ensure each one’s accountability for its part in the plan</li><li>Good place to learn and develop people</li><li>Main questions: Is the plan plausible and realistic? Internally consistent? Does it match the critical issues and assumptions? Are people committed to it?</li><li>Specific questions: How well versed is everyone about the competition? How strong is the org. capability to execute the strategy? Is the plan scattered or sharply focused? Are we choosing the right ideas? People-Ops link clear?</li></ul><h3>Operations Process</h3><ul><li>Translate strategies into near, medium and long-term milestones (analyze strategic goals and define the programs that’ll get you there)</li><li>Budget should be the financial expression of the operating plan</li><li>Follow through, contingencies, quarterly reviews (keep plans up-to-date, reinforce synchronization, give the leader an idea of who’s on top of the business)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40eaf8efe068" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Summary: High Output Management (Andy Grove)]]></title>
            <link>https://medium.com/@marcoscannabrava/summary-high-output-management-andy-grove-5106860be745?source=rss-fa7cbcfbe43e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5106860be745</guid>
            <category><![CDATA[decision-making]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[time-management]]></category>
            <category><![CDATA[management]]></category>
            <category><![CDATA[intel]]></category>
            <dc:creator><![CDATA[Marcos Cannabrava]]></dc:creator>
            <pubDate>Mon, 15 Jun 2020 22:35:39 GMT</pubDate>
            <atom:updated>2020-06-15T22:40:58.296Z</atom:updated>
            <content:encoded><![CDATA[<h3>Table of Contents</h3><ul><li><a href="#56fe">How to manage your career</a></li><li><a href="#bffe">Management as a Production System</a></li><li><a href="#05fc">Management Activities</a></li><li><a href="#3ab7">Delegation</a></li><li><a href="#233e">Time Management</a></li><li><a href="#ad95">Meetings</a></li><li><a href="#c964">Decisions</a></li><li><a href="#7820">Planning</a></li><li><a href="#5488">MBO (Mgmt By Objectives)</a></li><li><a href="#b491">Matrix Mgmt and Dual Reporting</a></li><li><a href="#5fbe">Modes of Control</a></li><li><a href="#8a75">Performance = Training + Motivation</a></li><li><a href="#69ae">Task-relevant maturity</a></li><li><a href="#11ea">Performance Appraisal</a></li><li><a href="#4139">Interview</a></li><li><a href="#e64a">Training is the boss’ job</a></li></ul><h3>How to manage your career</h3><ol><li>Are you adding real value or merely passing information along? How do you add more value? The output of a manager is the output of his organization. How can you add more value?</li><li>Are you plugged into what’s happening around your or do you wait for others to interpret it for you? Are you a node in the network or are you floating around by yourself? Be an “insider” in your company/market/industry. Know the right people, exchange with them often and make sense of the context around you. (e.g. Where is the market/company going? How is it evolving? What’s new and how does it change the status quo?)</li><li>Are you personally trying new ideas/techniques/technologies? Don’t wait for others to re-engineer your own workplace.</li></ol><h3>Management as a Production System</h3><h4>Task</h4><ul><li>Scheduled delivery time</li><li>Acceptable quality</li><li>Lowest possible cost</li></ul><h4>Indicators</h4><ul><li>Pairing to avoid overreacting (e.g. inventory levels vs inventory shortages)</li><li>Measure output and not activity</li><li>Leading vs Trend (stagger charts)</li></ul><h4>Inspections</h4><ul><li>Inspect at the lowest value stage</li><li>Variable frequency determined by track record</li></ul><p>Leverage through work simplification: create a flowchart of the work process and question each step. <strong>To optimize find the limiting step (bottleneck)</strong></p><blockquote><em>Written reports are mediums of self-discipline: writing them is important, reading maybe not. On-site visits are effective medium to exchange info.</em></blockquote><p>Managers must communicate to subordinates: <strong>objectives, priorities and preferences.</strong></p><blockquote>Allows better deliveries</blockquote><blockquote>Embedded in a corporate culture is better than formal rules/procedures</blockquote><h3>Management Activities</h3><ul><li>Info Gathering</li><li>Info Giving</li><li>Decision Making</li><li>Role Model</li><li>Nudging</li></ul><p>High Leverage Activities: Many people affected; One behaviour/activity affected for a long time by a brief action; Supplying unique piece of knowledge</p><p>Negative Leverage: Meddling</p><h3>Delegation</h3><p>Delegate and follow up at the lowest value stage and monitor decision making process through detailed questions</p><p>“Delegation without follow-through is abdication.”</p><h3>Time Management</h3><ul><li>Organize around bottlenecks</li><li>Batch similar tasks</li><li>Calendar as a forecasting tool</li><li>Say No at the outset</li><li>Raw material inventory (discretionary projects)</li><li>Standard responses</li></ul><h3>Meetings</h3><h4>Process-Oriented</h4><p><strong>One-on-one: Teach and Exchange</strong></p><ul><li>Frequency: defined by job maturity (situational leadership curve)</li><li>Content: Indicators, people problems, potential problems and future plans</li></ul><p><strong>Staff Meeting: Peer Discussion and Decision-Making</strong></p><p><strong>Operation Review: Showcase</strong></p><h4>Mission-Oriented: 5W2H output</h4><h3>Decisions</h3><h4>Types</h4><ul><li>Forward looking (e.g. capital allocation)</li><li>Crisis response: technical vs people</li><li>Decisions should be worked out and reached on the lowest competent level possible</li><li>Decision model: free discussion &gt; clear decision &gt; full support (go back to step 1 if it was the wrong decision)</li></ul><h4>Framework</h4><ul><li>What is the decision?</li><li>When should we decide?</li><li>Who will decide?</li><li>Who consults/validates/is-informed?</li></ul><h3>Planning</h3><ol><li>Establish need/demand/goal (forcast)</li><li>Establish present status (measure)</li><li>Compare the present-future states gap</li></ol><p><strong>The output of the planning process is an action implemented now</strong></p><h3>MBO (Mgmt By Objectives)</h3><ol><li>Where do I want to go? (Objectives)</li><li>How do I pace myself to get there? (Key Results)</li></ol><p>Break down a few big Objectives into smaller Key Results that will help measure the progress</p><p>Optimum and timely allocation of resources and the resolution of conflicts arising over that allocation is the job of the middle managers through the understanding of dual reporting and matrix mgmt.</p><h3>Matrix Mgmt and Dual Reporting</h3><ul><li>Functional Hierarchy Superior: specifies how the job ought to be done</li><li>Business Unit (BU) Hierarchy Superior: monitors how the job is being performed</li><li>Outside the job in the BU one can participate in a functional peer group or a mission-oriented task-force</li></ul><h3>Modes of Control</h3><ul><li>Free market — no supervision</li><li>Contract — mgmt sets rules and monitors performance</li><li>Cultural values — under uncertain/ambiguous circumstances</li><li>Trust from shared values, objectives and methods</li></ul><blockquote>“Expectations can be as binding as a legal document.”</blockquote><h3>Performance = Training + Motivation</h3><ul><li>Motivation = keeping some attainable unsatisfied needs</li><li>Maslow’s hierarchy: physiological &lt; safety &lt; social &lt; recognition &lt; self-actualization (personal best)</li><li>MBO &gt; indicator/performance measures &gt; task-relevant feedback (allows people to track their progress) — autonomy + mastery + purpose</li></ul><h3>Task-relevant maturity</h3><ul><li>Low: 5W2H</li><li>Medium: individual-oriented two-way communication (mutual reasoning)</li><li>High: Establish objectives and monitor</li></ul><blockquote>“Only make friends at work if you can imagine yourself delivering a tough performance review.”</blockquote><h3>Performance Appraisal</h3><h4>Assessment: clear expectations vs (output + internal measures, long/short-term)</h4><ul><li>Evaluate results instead of potential</li></ul><h4>Delivery: Level, Listen, Leave yourself out</h4><ul><li>Choose a few key points with examples and suggest improvement plan</li></ul><h3>Interview</h3><h4>Evaluate</h4><p>Look for:</p><ul><li>Technical skills (know-how) vs Applied know-how (track record)</li><li>Discrepancies (failures, problems, etc)</li><li>Operational values</li></ul><h4>Educate</h4><h4>Mutual match</h4><h4>Sell the job</h4><h3>Training is the boss’ job</h3><ul><li>List the necessary skills</li><li>Take inventory of materials and resources</li><li>Set a schedule and commit to preparing the classes</li><li>Ask for anonymous feedback</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5106860be745" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker: Development and Production Environments]]></title>
            <link>https://blog.devgenius.io/docker-development-and-production-environments-6f78e3e745ca?source=rss-fa7cbcfbe43e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f78e3e745ca</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[docker-compose]]></category>
            <dc:creator><![CDATA[Marcos Cannabrava]]></dc:creator>
            <pubDate>Sun, 07 Jun 2020 15:19:13 GMT</pubDate>
            <atom:updated>2020-06-12T12:13:39.342Z</atom:updated>
            <content:encoded><![CDATA[<p>No bloat, unsplash images, funny gifs. This concise post covers how to use Docker to set up development and production environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*V__2_A5w_TMC3BJt1V5Dmw.png" /><figcaption>Docker Architecture (image from <a href="https://docs.docker.com/get-started/overview/">Official Docs</a>)</figcaption></figure><p>In this post we’ll try to explain all essential Docker concepts setting up a MERN stack application with the following structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Le_pfxE2O6M0dBtHlRV11Q.png" /><figcaption>MERN (Mongo Express React Node) Architecture with a DB admin client</figcaption></figure><h3>Basic Docker Concepts</h3><ul><li><strong>Docker</strong>: Packs applications with dependencies into a virtual container.</li><li><strong>Active hosts</strong>: Computer with Docker installed and the Docker daemon running on the supported version.</li><li><strong>Client</strong>: Primary user interface for the Docker daemon that can run on a separate system and communicates via sockets or RESTful APIs.</li><li><strong>Container</strong>: Holds everything that is needed for an application instance or an instance group to run (OS, dependencies, etc).</li><li><strong>Docker daemon</strong>: Builds, runs and manages containers on a host.</li><li><strong>Image</strong>: Template for creating containers that contains the installations of an application instance or instance group with its software, dependencies and the process to run when launching the container.</li><li><strong>Docker registries</strong>: Repositories of images for users to upload or download. The public Docker registry is called the Docker Hub.</li></ul><h3>Client: Dockerizing a React App</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*wjErK6Ec7r1sEgeM6RXh-A.png" /><figcaption>Dockerfile (for development)</figcaption></figure><blockquote>The first line “FROM …” tells Docker to use a certain image (e.g. node:12-alpine) from the Docker Hub as a starting point for creating this container.</blockquote><p>Create a Dockerfile in the root directory of your React app like the one above. Your fullstack app should have a folder tree similar to this:</p><pre>root/<br>|/client/<br>  | Dockerfile<br>  | Dockerfile.prod<br>|/server/<br>  | Dockerfile<br>  | Dockerfile.prod<br>|docker-compose.yml</pre><p>If you want to test your React App as a standalone, run the following:</p><pre># Builds Image, -t tags it as &#39;react-app&#39;, Dockerfile is in .<br>docker build -t react-app .<br># Runs Container from Image &#39;react-app&#39;<br>docker run -it --rm -p 3000:3000 react-app</pre><p>Go to <a href="http://localhost:3000/">http://localhost:3000/</a> to check your app.</p><pre># Other interesting commands<br><strong>docker images</strong> # lists images available on your machine<br><strong>docker ps</strong> # lists docker containers running</pre><h3>Server: Dockerizing an Express Server</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*eu_YrLyI5kYegHUNN3jhmw.png" /><figcaption>Dockerfile</figcaption></figure><p>Building and running the Dockerfile above will run the Express server as a standalone container.</p><p>…now, the best part:</p><h3>Dockerizing a Full Stack MERN Application</h3><p>Introducing <a href="https://docs.docker.com/compose/"><strong>docker-compose</strong></a><strong>.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82b22f56113758aa994a1824df9331d2/href">https://medium.com/media/82b22f56113758aa994a1824df9331d2/href</a></iframe><p>Docker-Compose gives you the full power of Docker in a much more user-friendly interface. By configuring this YML file you avoid extremely long command line directives. With this file set up, run the following:</p><pre># This will start all services described in the yml file.<br>docker-compose up<br># Run docker-compose down or press ctrl+c to stop the containers.<br># The following options can be interesting<br>docker-compose up [service] # starts just the services described<br>docker-compose build [service] # rebuilds the images of the services</pre><ol><li><strong>Frontend</strong>:<strong> </strong>Builds the image from the Dockerfile located in ‘client’ folder and runs it on port 3000.</li><li><strong>Backend</strong>: Same with the Express Server</li><li><strong>Mongo &amp; Mongo-Express</strong>: Docker Hub gives you free images of plenty of services. 2 of them are MongoDB and MongoExpress. You don’t need to install databases in your local development machine anymore. 20 lines of code are enough to set up your DB and an Admin Client. 🤯</li></ol><p>To me docker-compose is the hidden gem of Docker 💎.</p><h3>What about the Production Environment?</h3><p>I won’t get in too much detail here as the stakes are quite higher. The goal in this section is to point in the direction of the changes you should make and concerns you should have in translating this setup to production.</p><ol><li><strong>Frontend</strong>: I used <a href="https://github.com/facebook/create-react-app">create-react-app</a> so instead of <strong>yarn start</strong> I should use <strong>yarn build</strong> in one of the many ways <a href="https://create-react-app.dev/docs/deployment/">detailed here</a>.</li><li><strong>Backend</strong>: Many possiblities... One idea is to create a web server with <a href="http://nginx.org/">NGINX</a> to serve the backend and frontend. Maybe <a href="https://hub.docker.com/_/nginx">Docker Hub’s NGINX</a>?.</li><li><strong>Database</strong>: It’s a bit of a polarizing subject whether you should run production DB’s in containers or not. Given that and the fact I’m not a Pro DB manager or Container expert, I don’t.</li></ol><h3>Resources</h3><ol><li><a href="https://docs.docker.com/">Official Docker Docs</a></li><li><a href="https://dev.to/softchris/5-part-docker-series-beginner-to-master-3m1b?wt.mc_id=personal-blog-chnoring">Chris Noring’s 5 part Docker series</a> <em>(</em>🔥<em>better than the docs)</em></li><li><a href="https://mherman.org/blog/dockerizing-a-react-app/">Michael Hermans’s Dockerize a React App Article</a> <em>(</em>🔥<em>another approach)</em></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f78e3e745ca" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/docker-development-and-production-environments-6f78e3e745ca">Docker: Development and Production Environments</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git: Download a Repository’s Specific Subfolder]]></title>
            <link>https://medium.com/@marcoscannabrava/git-download-a-repositorys-specific-subfolder-ceeabc6023e2?source=rss-fa7cbcfbe43e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ceeabc6023e2</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Marcos Cannabrava]]></dc:creator>
            <pubDate>Thu, 04 Jun 2020 17:12:58 GMT</pubDate>
            <atom:updated>2020-06-04T17:12:58.433Z</atom:updated>
            <content:encoded><![CDATA[<p>No bloat, unsplash images, funny gifs. This concise post covers how to clone specific subfolders from a given git repository. AKA the reverse .gitignore file.</p><pre>mkdir example_folder<br>cd example_folder<br>git init<br>git remote add origin &lt;repository_url&gt;<br>git sparse-checkout init<br>git sparse-checkout set &lt;/path/to/folder/you/want&gt;<br>git sparse-checkout add &lt;/another/folder/you/want&gt;  # optional<br>git pull origin master<br>ls</pre><p>Repeat the commands above and you’re done. Below you’ll find more details on what they’re doing.</p><ol><li>Start a git repo in a certain folder (e.g. example_folder)</li><li>Add the repo you want as a remote origin</li><li><strong>git sparse-checkout </strong>is the hack here:</li></ol><blockquote>It creates a file called sparse-checkout which is basically the reverse of .gitignore. That is, whatever you write in it (folders/files) is the only thing git cares about.</blockquote><p>4. Once you <strong>git pull</strong>, only the folders/files you want will be downloaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yDG9NCwJTJnwzMD6NiyrCg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ceeabc6023e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git: Rewriting History with Rebase]]></title>
            <link>https://medium.com/@marcoscannabrava/git-rewriting-history-with-rebase-4093802fe173?source=rss-fa7cbcfbe43e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4093802fe173</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[workflow]]></category>
            <dc:creator><![CDATA[Marcos Cannabrava]]></dc:creator>
            <pubDate>Wed, 03 Jun 2020 19:39:58 GMT</pubDate>
            <atom:updated>2020-06-04T12:23:19.266Z</atom:updated>
            <content:encoded><![CDATA[<p>No bloat, unsplash images, funny gifs. This concise post covers how to rewrite git history keeping commits and branches clean and descriptive.</p><pre># This post revolves around --rebase-merges flag which became available in git version 2.18.2. Update your git CLI if necessary.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*wW-Q_dEyM0vtMlJgn93P9w.png" /></figure><ol><li>Git history full of partial-work commits and bad messages. 👎</li><li>Git history with one or few commits per branch. 👍</li></ol><p>One way to clean git history keeping the branches and rewriting commit messages is to use the <strong>git rebase interactive</strong> tool.</p><p>First use <strong>git log</strong> to find the first commit in your history then use <strong>git rebase</strong><em> </em>to start rewriting history as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*hP6YRcwUCjwuMEiJV8OFCA.png" /><figcaption>Step 1: git rebase -i — rebase-merges [first-commit]</figcaption></figure><p>The gist of this post is running <strong>rebase</strong> with <strong>interactive</strong> and <strong>rebase-merges</strong> flags from the <strong>first commit </strong><em>(08f64b9 in the example above)</em>. This command will open the following file on your IDE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*Y3kGa_adjbiIve0JjLLvDQ.png" /><figcaption>Step 2: editing git-rebase-todo file</figcaption></figure><p>Notice how you can see both Feat B and Feat A branch and all of its commits. Also several comments explain you how to edit the commits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*9Y6dqHcftAnEz6B95wTUNQ.png" /><figcaption>Step 2: r is for rewriting commit msg, s is for squashing (“deleting”)</figcaption></figure><p>In the image above all partial-work commits are squashed into one commit with a Good Commit Msg (please Google how to write one). The commits from other theoretical branches are kept since it’s not what the developer wanted to change in this example.</p><blockquote>Check with your team how and if you should use git rebase in your git workflow.</blockquote><blockquote>Rewriting the history of your branch to push work with clear commits is <strong>ok</strong>.</blockquote><blockquote>Rewriting other developers’ history is <strong>not ok</strong>.</blockquote><p>After closing the <strong>git-rebase-todo</strong> the rebase process continues and you’ll probably see screens like the ones below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*IUUxMhiQKs5EO0cxpWCC-w.png" /><figcaption>Just close it.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*EfmmJjJ5BP5Mlx7georyKg.png" /><figcaption>Delete the commit msgs you don’t want and keep the one you do want or rewrite with a Good Commit Msg!</figcaption></figure><p>Problems will show up. The way git rebase works is that it basically retraces the steps you took from that “first-commit” you put in the <strong>git rebase -i</strong> cmd.</p><p>When we reach a point in the code history when we had a conflict we’ll need to solve it again. <em>(there could be a workaround and I just never bothered to look so if anyone knows please share on the comments)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*n8D5ojNdzRrz291Hz9nejg.png" /><figcaption>Step 3: Fix conflicts…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*g-iN61ZwG8moz18Luyfelg.png" /><figcaption>gst = git status -&gt; shows the files with conflicts.</figcaption></figure><blockquote>You shouldn’t be having conflicts in rebase when dealing with production code. If you are, there’s some git history you probably shouldn’t be messing with.</blockquote><pre># after resolving a conflict run:<br>git rebase --continue</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*pDaNQvTgUx75k84mdS8QYw.png" /><figcaption>More conflicts. Fix them. Continue. Success!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*znd0O51GNQmauA-gH4B34w.png" /><figcaption>Final commit history</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4093802fe173" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Asynchronous JS in < 30 lines of code]]></title>
            <link>https://medium.com/@marcoscannabrava/asynchronous-js-in-30-lines-of-code-5e3cf72dc10c?source=rss-fa7cbcfbe43e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e3cf72dc10c</guid>
            <category><![CDATA[asynchronous]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Marcos Cannabrava]]></dc:creator>
            <pubDate>Thu, 28 May 2020 01:24:30 GMT</pubDate>
            <atom:updated>2020-06-08T21:01:03.436Z</atom:updated>
            <content:encoded><![CDATA[<p>No bloat, unsplash images, funny gifs. This concise post covers:</p><ol><li>Promises (e.g. fetch calls)</li><li>Async Functions (i.e. clean way to write a Promise)</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38802d6dd61993d4ae23a242ccafae34/href">https://medium.com/media/38802d6dd61993d4ae23a242ccafae34/href</a></iframe><p><strong>An example of Async Function</strong></p><blockquote><em>Want to read this story later? Save it in </em><a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=blog&amp;utm_campaign=noteworthy&amp;utm_content=eid7"><em>Journal</em></a><em>.</em></blockquote><p>Every fetch or axios call in React or Mongo driver calls in Express is an example of asynchronous code. A call is made to a server or database somewhere that takes a while to answer back. Meanwhile life goes on and so does your code. These calls return a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a> and this post shows one way to handle them.</p><p>Handling Promises usually requires very case by case patterns but I came up with this particular pattern when populating several MongoDB collections in sequence and it turned out to use all the basics in dealing with Promises. So here’s my attempt at shining some light on the topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*84A_FHscLqDqsNytFbinZg.png" /><figcaption><em>Don’t understand the above? Take a look at the </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"><em>docs</em></a><em>. That’s a Promise.</em></figcaption></figure><p>Promises have two outcomes: Resolution or Rejection. The one above resolves 70% of the times in 100 ms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*sfDUXB43gvG0cuCyFlg9vA.png" /><figcaption>The simplest most intuitive way to use a Promise: .then</figcaption></figure><p>The <em>then</em> method takes two parameters:</p><blockquote>1st. a function that handles resolution.</blockquote><blockquote>2nd. a function that handles rejection.</blockquote><p><em>Promises can also be handled with catch (to handle errors).</em></p><p>If you just need to handle one promise stop reading this post and go back to coding. Now, if you have more than one, <strong>maybe</strong> you would benefit from reading the rest. But probably going back to coding and leaving this tab open is the best course of action anyway.</p><p>2 possible scenarios now:</p><ol><li>The rest of your code depends on the result of previous Promises.</li><li>The rest of your code AND following Promises depende on previous ones.</li></ol><h4>1) Code dependent on previous Promises</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*Cu1ssFwSVYNcz33BhzHvsg.png" /><figcaption>Put all your Promises in variables and “<strong>await </strong>them all at once”.</figcaption></figure><p>If you need to await for a Promise use the keyword <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await">await</a>. JavaScript is incredibly obvious, don’t let them tell you otherwise.</p><p>The thing about <strong>await </strong>is that it only works inside <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">async</a> functions.</p><blockquote>Basically if a part of your code is “awaiting” for something it is behaving like a Promise so this piece of code should be a Promise (= inside an Async Function).</blockquote><p>What happens on the code <a href="https://gist.github.com/marcoscannabrava/0d4dc8eed0575f57989f795e3cc83cdf">at the beginning of this post</a> is that 2 promises are called and start running simultaneously. When the code reaches the <strong>await Promise.all([..]) </strong>line it stops and resumes once they’ve all responded.</p><h4>2) Promises dependent on previous Promises</h4><p>The problem with the strategy above is that if PromiseB depended on PromiseA the code inside PromiseB would throw out an <strong>undefined</strong> error whenever it tried to use the result of PromiseA. This is how you fix it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*QIbzuw5whcIEhiGiyH0EdA.png" /><figcaption><strong>Await</strong> each Promise.</figcaption></figure><p>If you liked it send some <strong>claps </strong>down there or <a href="/service/mailto: mpcannabrava@gmail.com">an email</a>.</p><figure><a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=blog&amp;utm_campaign=noteworthy&amp;utm_content=eid8"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ArLSH4tuI2v4pF0giI3-OQ.png" /></a></figure><p>📝 Save this story in <a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_read_later_text">Journal</a>.</p><p>👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. <a href="https://usejournal.com/newsletter/noteworthy-in-tech/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_text">Read the Noteworthy in Tech newsletter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e3cf72dc10c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>