<?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 Meeshkan ML on Medium]]></title>
        <description><![CDATA[Stories by Meeshkan ML on Medium]]></description>
        <link>https://medium.com/@meeshkan?source=rss-af095ee17e3f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SWkXCXzWrUqAlH7Wg3Fhfw.png</url>
            <title>Stories by Meeshkan ML on Medium</title>
            <link>https://medium.com/@meeshkan?source=rss-af095ee17e3f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 20:00:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@meeshkan/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[How to power a beautiful React UI with your favorite APIs]]></title>
            <link>https://medium.com/@meeshkan/how-to-power-a-beautiful-react-ui-with-your-favorite-apis-c502f099a086?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c502f099a086</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Mon, 27 May 2019 08:41:25 GMT</pubDate>
            <atom:updated>2019-05-27T08:41:25.664Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R7tNTm46apKY9zAPZuu04g.png" /></figure><p>Designing and building a beautiful web UI has never been easier — in 2019, there exists a rich ecosystem covering almost every step of the process, from component libraries to packaging tools.</p><p>There is, however, one oft-ignored aspect in the process: that moment where your carefully-crafted components are hooked to the data coming from an external API. There are many things that can go wrong here: missing fields can cause elements to go awry, too long texts can cause collisions and overflow, and variable array sizes result in flex-box catastrophes. Also, setting up mock data for development is time-consuming and prone to errors.</p><p>In this article, we want to show how to <em>start with rich JSON data from an API and build the components around the data</em>, making sure that they accommodate different possible corner cases and layouts.</p><p>We will build a design app powered by <a href="https://www.behance.net/">Behance</a>, a platform for creative folks to showcase their work. We would like data from Behance to drive our app and its development, but <a href="https://www.behance.net/dev/api/endpoints/">Behance API</a> has pretty strict rate-limiting that makes development awkward. To get around this, we’ll use <a href="http://unmock.io/">unmock</a> to capture HTTP calls to Behance and receive mock data instead. The main use-case for unmock is to mock API calls in <em>tests</em>, but we can use it here as a convenient development tool.</p><p>While it is possible to use unmock without signing up, it is highly recommended to do so at <a href="https://www.unmock.io/">https://unmock.io</a>. It’s free and using your own unmock token ensures that your mocks are not visible to other users.</p><p>In order to make the Behance API come to life, we will use <a href="https://v2.grommet.io/">Grommet</a>, a React framework providing “accessibility, modularity, responsiveness, and theming” for UIs. It includes powerful theming tools, comes with <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">CSS Flexbox</a> and <a href="https://css-tricks.com/snippets/css/complete-guide-grid/">Grid</a> to provide layouts for all devices, and even has its own <a href="https://icons.grommet.io/">icons</a>.</p><p>The full code with instructions is available in <a href="https://github.com/unmock/next-grommet-example">GitHub</a>.</p><h4>Project setup</h4><p>We use <a href="https://nextjs.org/">Next.js</a> to build our example app. Next.js is a React framework that <a href="https://nextjs.org/#features">adds</a> file-system routing, automatic code splitting, and server-side rendering to a React app. That’s a mouthful, but suffice it to say that we love Next.js for its flexibility and performance. You can even export your Next.js app as a static site, which is perfect for light-weight use-cases like landing sites, blogs, or documentation. If you’ve never used Next.js before, don’t worry: we’ll cover the basics along the way.</p><p>Let’s take a look at our project’s package.json:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95c8c13d541bf5b38d7fa3143bb2b113/href">https://medium.com/media/95c8c13d541bf5b38d7fa3143bb2b113/href</a></iframe><p>In the project dependencies, we include the expected stuff: Grommet for style, React and Next.js, <a href="https://github.com/unmock/unmock-js/tree/dev/packages/unmock-node">unmock-node</a> and <a href="https://github.com/unmock/unmock-js/tree/dev/packages/unmock-jsdom">unmock-jsdom</a> to capture HTTP calls in the server and browser, and axios to create HTTP calls. <a href="https://www.npmjs.com/package/@zeit/next-typescript">@zeit/next-typescript</a> plugin is used along with next/babel plugin to compile TypeScript and Next.js into JavaScript and HTML. These plugins are listed in <a href="https://github.com/unmock/next-grommet-example/blob/master/.babelrc">.babelrc</a>.</p><p>In the “scripts “ object of package.json, we define command-line scripts used for development. Running yarn startin the terminal (or npm start if you prefer to use npm) starts the local development server with hot module reloading.</p><p>If you signed up for unmock, you should define UNMOCK_TOKEN as an environment variable by, for example, starting your app with</p><pre>UNMOCK_TOKEN={YOUR_TOKEN_HERE} yarn start</pre><p>In <a href="https://github.com/unmock/next-grommet-example/blob/master/next.config.js">next.config.js</a>, we customize the webpack configuration with <a href="https://webpack.js.org/plugins/environment-plugin/">EnvironmentPlugin</a> to ensure that UNMOCK_TOKEN is available also in the client code. Remember to remove the token from any client-side code if you ever decide to publish your app!</p><p>Finally in package.json, we mark unmock-node to be excluded from the browser build with browser: { unmock-node: false }. You can read more about including and excluding modules from the client or the server code in <a href="https://arunoda.me/blog/ssr-and-server-only-modules">this article</a>.</p><p>We won’t go deeper into the project setup here, but you can take a look at <a href="https://github.com/unmock/next-grommet-example/blob/master/tsconfig.json">tsconfig.json</a> (compiler options for TypeScript) and <a href="https://github.com/unmock/next-grommet-example/blob/master/next.config.js">next.config.js</a> (Next.js configuration) in GitHub.</p><h4>Building our page</h4><p>Next.js uses file-system routing to serve pages. This means that pages are served from pages/ folder with the names of the files corresponding to their routes. Our app only contains a single page served from the root of our app, so we’ll name the file index.tsx. Here’s the code for our page:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17e3cfd2578d9bdf0ae2cd6b91cff326/href">https://medium.com/media/17e3cfd2578d9bdf0ae2cd6b91cff326/href</a></iframe><p>This file exports a React class named MainComponent decorated with the static getInitialProps method. This function is a Next.js feature used to populate the component properties in the server when the page is first loaded. We use it to download Behance projects with the getProjectsWithComments function. To be served back mock data instead of real Behance data, we also initialize unmock-node here.</p><p>The componentDidMount method of MainComponent is invoked in the client code immediately after the component is mounted in the DOM tree. We require and initialize unmock-jsdom here to capture outgoing HTTP calls <em>in the browser.</em> We do not want to include unmock-jsdom in our server build, so we import the library inside componentDidMount. If you’re interested to know more about client- and server-only modules in Next.js, we refer to <a href="https://arunoda.me/blog/ssr-and-server-only-modules">this article</a>.</p><p>The render() method of our MainComponent checks the err property to see if everything went smoothly when fetching data. If there’s no error, the component renders ProjectsGrid component that we’ll go through later. In case of an error, it renders the simple <a href="https://github.com/unmock/next-grommet-example/blob/master/components/error-component.tsx">ErrorComponent</a>.</p><h4>Introducing the Grommet theme</h4><p>To add a common theme to our app with Grommet, we’ll <a href="https://nextjs.org/docs#custom-app">customize the Next.js App component</a> in _app.tsx file. Appcomponent is used by Next.js to initialize all pages, so it’s a perfect place to define a custom theme and layout shared by all pages. Our _app.tsx file exports a React class component and looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ad9fc11b4470d537af56bef96e8d040/href">https://medium.com/media/0ad9fc11b4470d537af56bef96e8d040/href</a></iframe><p>We first define our <a href="https://github.com/grommet/grommet/wiki/Grommet-v2-theming-documentation">Grommet theme</a>. The theme sets the so-called base theme for all child components wrapped in the &lt;Grommet theme={theme}&gt; component in the render() method below.</p><p>We also define an AppBar component and include it in the render()method to have it show up at the top of every page in our app. AppBarand child component view are rendered in Grommet <a href="https://v2.grommet.io/box">Box components</a>. Box is a Grommet container that provides, for example, CSS flexbox capabilities for layout.</p><h4>Fetching data from Behance</h4><p>The code for fetching data from Behance is in <a href="https://github.com/unmock/next-grommet-example/blob/master/util/behance.ts">util/behance.ts</a>. The file defines two functions, getProjectsWithComments and getProject:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe25ed0e450233d65055b109d96092ec/href">https://medium.com/media/fe25ed0e450233d65055b109d96092ec/href</a></iframe><p>The getProjectsWithComments function first calls Behance API at <a href="https://www.behance.net/v2/projects">/v2/projects</a> endpoint to load recent projects. According to the <a href="https://www.behance.net/dev/api/endpoints/1#projects-get-10">API documentation</a>, the response contains the field projects, which we store to the projects variable. Here’s a sample mock project returned by unmock:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/02e6a920e6e575fe8d463322ecd8731b/href">https://medium.com/media/02e6a920e6e575fe8d463322ecd8731b/href</a></iframe><p>Comments for each project are downloaded from /v2/projects/{projectId}/commentsendpoint with projects.map. The list of promises is awaited in Promise.all and the projects and their comments are returned in an array of objects.</p><p>The getProject function is used in our client components below to download project details when the user clicks a button. The decision to fetch project comments in server-side and project details in the client-side is done here for the sake of demonstration: you should decide which approach works best for your app.</p><h4>Project grid</h4><p>Remember how we included &lt;ProjectsGrid&gt; component in our index.tsx? Here’s the code for the component, excluding imports and type definitions:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ffa556a6a5f399ad4c11230d8f7c370/href">https://medium.com/media/2ffa556a6a5f399ad4c11230d8f7c370/href</a></iframe><p>The exported ProjectsGrid is a pure function component that takes props as argument and returns a template with <a href="https://v2.grommet.io/grid">Grid</a> as outer-most element. Inside the grid, we add a ProjectBox component for each project. We’ll go and see the code for ProjectBox soon, but let’s first talk about state.</p><p>Each ProjectBox contains two buttons for interacting with the UI state. For example, when the user clicks the “Description” button, we want to open a modal overlay that shows the details of the clicked project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*drNlTTd6rVact6QWAT1o8w.png" /><figcaption>Modal overlay for project description</figcaption></figure><p>Showing the modal overlays is triggered by the onOpenDescription and onOpenComments functions. These functions interact with the view via state, which we manage with React hooks. For example, for managing the state of the project description dialog, the relevant code is as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff2001ace435db1be08812cd311d5541/href">https://medium.com/media/ff2001ace435db1be08812cd311d5541/href</a></iframe><p>When the onOpenDescription(projectId) is called (by the user clicking the “Description” button inside ProjectBox), we download project details from Behance API and set the data to the projectDetailsOpenForId state variable. Remember that we use unmock to capture the calls.</p><p>As the projectDetailsForOpenId variable becomes defined, the component renders DescriptionModal component and sets the project details now stored to the state as component properties. Also, the closeDescription function is injected to the child component so that the dialog can itself by resetting the state when the user clicks outside the dialog.</p><p>DescriptionModal component looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d9f301546befea9c7fa6577a31ce91e/href">https://medium.com/media/8d9f301546befea9c7fa6577a31ce91e/href</a></iframe><p>The modal overlay uses Grommet’s <a href="https://v2.grommet.io/layer">Layer</a> component to define an overlay anchored to the center of the window. When the user clicks outside of the window or presses the escape key, props.close is called to close the dialog.</p><p>The code for <a href="https://github.com/unmock/next-grommet-example/blob/master/components/comments-open-modal.tsx">comments-open-modal.tsx</a> is similar, with the exception that comments for each project are fetched in the <em>server-side</em> when loading projects. With this strategy, initial page load takes a bit longer but the comment overlay opens instantly when the user clicks the button. You may want to mix these two strategies (eager and lazy data loading) in your own application depending on the UX you’re after.</p><p>Finally, ProjectBox is defined as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e049829253e7f50ccb7dbd057ad248c/href">https://medium.com/media/7e049829253e7f50ccb7dbd057ad248c/href</a></iframe><p>As the name implies, the component lives in a <a href="https://v2.grommet.io/box">Box</a>. Inside each box, we include a heading, project <a href="https://help.behance.net/hc/en-us/articles/204483484-What-is-a-Cover-Image-">cover image,</a> and the buttons for opening project details and comments.</p><h4>Conclusion</h4><p>That’s it for our app, we covered a lot! Your final app should look like the following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nNRTw6G3M4IVCnXj-tVnRw.png" /><figcaption>Our app</figcaption></figure><p>If you want to dive deeper, you could add, for example,</p><ul><li>more pages and navigation buttons</li><li>client-side navigation between the pages with <a href="https://nextjs.org/docs#with-link">Link</a></li><li><a href="https://dev.to/aprietof/nextjs--styled-components-the-really-simple-guide----101c">server-side rendering</a> of styled-components (used by Grommet)</li></ul><p>Please leave feedback or questions in the comments below! If you’re interested in building Dev Tools 2.0 with us, check out our open positions in <a href="https://thehub.fi/jobs/company/meeshkan">The Hub</a> or contact us with an open application. Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c502f099a086" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why OpenAPI specs rock and how to create one]]></title>
            <link>https://medium.com/@meeshkan/why-openapi-specs-rock-and-how-to-create-one-bea0b599f42?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/bea0b599f42</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[open-api]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[openapi-specification]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Thu, 09 May 2019 08:23:27 GMT</pubDate>
            <atom:updated>2019-05-13T12:17:32.778Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>How to avoid the chore of manually creating a specification from an API reference?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0DXJszXJfJ1DPOgnxRmoA.jpeg" /><figcaption>OpenAPI specification in Visual Studio Code</figcaption></figure><p>In an ideal world, every RESTful API would have an <a href="https://swagger.io/specification/">OpenAPI specification</a>. As a user of the API, you could take advantage of the specification to</p><ul><li><a href="https://github.com/OpenAPITools/openapi-generator">autogenerate client code</a></li><li><a href="https://blog.apisyouwonthate.com/the-many-amazing-uses-of-json-schema-client-side-validation-c78a11fbde45">validate API requests</a></li><li><a href="https://www.getpostman.com/">test API calls from a GUI</a></li></ul><p>If you develop an API, you should create an OpenAPI specification to</p><ul><li><a href="https://www.soapui.org/">create test suites</a></li><li><a href="https://blog.apisyouwonthate.com/turning-contracts-into-beautiful-documentation-deac7013af18">generate and deploy documentation</a></li><li><a href="https://swagger.io/tools/swagger-codegen/">autogenerate server code stubs</a></li><li><a href="https://stoplight.io/mocking/">create mock servers</a></li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FzOVjALkVxHElO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FzOVjALkVxHElO%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FzOVjALkVxHElO%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="240" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4cc5cc7cf0a9ee61ccfd15b95dd1017/href">https://medium.com/media/d4cc5cc7cf0a9ee61ccfd15b95dd1017/href</a></iframe><p>There are a plethora of other tools available and it’s impossible to list them all, but you can take a look <a href="https://openapi.tools/">here</a> for a more comprehensive list.</p><p>Unfortunately, not every API in the real world has a formal specification. Especially many of the older APIs only publish an API reference online, and manually creating a specification from such a reference is error-prone and time-consuming.</p><p>If you’re lucky, you may find that someone else has uploaded an up-to-date specification to <a href="https://apis.guru/openapi-directory/">apis.guru</a>. If not, there are tools like <a href="https://swagger.io/tools/swagger-editor/">Swagger editor</a> that help creating a specification, but it still requires a lot of tedious copy-and-pasting between the reference and the editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5u2Pb3Qdt-z7XlftHULLaw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/ri0ylwID5ao?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Martina Misar-Tummeltshammer</a> on <a href="https://unsplash.com/search/photos/tired?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>To reduce the manual work, we created <a href="https://github.com/unmock/unmock-webextension">unmock-openapi-builder</a>, a Chrome and Firefox-compatible web extension that simplifies the process of creating OpenAPI specs. While our core product, <a href="https://unmock.io/">unmock</a>, uses machine learning techniques under the hood to create API specifications, the extension uses simple rules to detect API operations from the page content and autogenerates an OpenAPI specification. Smart, eh?</p><p>The smart builder is still in early-stage development, so the extension includes an embedded Swagger editor that you can use to fill in the missing parts, with all the Swagger-goodness available for spec validation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P6Ltqajmvilqe1AWC1j7PA.png" /><figcaption><a href="https://github.com/unmock/unmock-webextension">unmock-openapi-builder</a> extension in Chrome</figcaption></figure><p>The extension is currently undergoing review for Chrome web store, but while waiting, you can install the extension directly from <a href="https://github.com/unmock/unmock-webextension#development">GitHub</a>. We warmly welcome contributions, feature requests, and issue reports in the repository. We are planning to add features such as</p><ul><li>highlighting added operations in the web page to quickly see what you’ve added and what is still missing</li><li>shortcuts for adding items from the web page to the specification</li><li>improving the smart parser to handle more APIs</li></ul><p>Which features do you think would be most useful? Which APIs would you like to see have an OpenAPI specification?</p><p>In a follow-up article, we’ll talk about writing a browser-agnostic web extension using Webpack and TypeScript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bea0b599f42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why we are mocking the world’s APIs]]></title>
            <link>https://medium.com/@meeshkan/why-we-are-mocking-the-worlds-apis-e16c4f339ee3?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e16c4f339ee3</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[product]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Fri, 03 May 2019 08:35:13 GMT</pubDate>
            <atom:updated>2019-05-03T08:42:35.594Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>With so many different tools in the mocking world, why bother creating a new one?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yFHk56Z_r5MIHHaa" /><figcaption>Photo by <a href="https://unsplash.com/@pankajpatel?utm_source=medium&amp;utm_medium=referral">Pankaj Patel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We’re building DevOps tools 2.0, and our first product — <a href="http://www.unmock.io/"><strong>unmock</strong></a><strong> </strong><em>(we like to avoid caps-locking it)</em>— took a few twists and turns before coming into fruition. We like to think of it as “<a href="https://www.unmock.io/about"><em>The Internet. Mocked.</em></a>” But there are many competitors in the mocking world; from language specific to method-specific, they all offer various tools and instruments for mocking your favorite APIs. How is unmock special? How is it different and why do we even work on a new tool in such a proliferated niche world?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*1NMixMPdEf2s1u3NAVuBaQ.jpeg" /><figcaption>Comic Relief</figcaption></figure><p>First, why do people even mock, to begin with? In a test-driven development (TDD) environment, mocking is a common way to handle 3rd party dependencies. It has all kinds of benefits, but you can read about it more in depth <a href="https://medium.com/@kapil.aggarwal1/api-mocks-and-why-should-we-care-418b24c35c25">here</a> and <a href="https://www.embedded.com/design/prototyping-and-development/4398723/The-mock-object-approach-to-test-driven-development">here</a>, for example.</p><p>When gearing up and mocking things, there are many <a href="https://dev.to/asizikov/you-are-mocking-it-wrong-5gh3">common pitfalls</a> that are quite often overlooked. Eric Elliott, author of <em>Programming JavaScript Applications</em> and a TDD advocate, even says <a href="https://medium.com/javascript-scene/mocking-is-a-code-smell-944a70c90a6a">mocks are code smells</a>. <a href="https://dev.to/adamwknox/i-made-a-mistake-implementing-a-react-hook-and-got-a-denial-of-service-from-my-backend-5cji">Forgetting to mock also has its downsides</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*X0V-P9FoXi_kB7ZW4DzaxA.jpeg" /><figcaption>How is unmock special (or, why you should give it a go!)</figcaption></figure><p>As I’ve mentioned, <a href="http://www.unmock.io/">unmock</a> has taken a few twists and turns. Learning from our own mistakes, as well as from others’, we set out to bring a tool that’s as minimal and automatic as possible. <strong>You code, we mock. </strong>We stand out from the crowd and plethora of other mocking services, in that we’re a <strong>fully automated, JIT mocking service, with minimal intrusion</strong> to your codebase. Our <a href="https://github.com/unmock/unmock-js">SDK</a> is essentially a one-liner (available in many languages). <em>Behind the scenes, we track thousands of APIs and use state of the art NLP techniques to understand how the API should work. </em>We intercept your tests requests and return a <strong>semantically coherent response.</strong> You no longer have to worry about mocking your content or accidentally hitting the real API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*CBkzStRMUfkQPm1-XhpFtA.jpeg" /></figure><p>We don’t stop there. We also provide a “<strong>flaky</strong>” mode to replicate the occasional missed requests and various errors in your target API. With our “<strong>random</strong>” mode, we provide non-deterministic responses, with the hopes of helping you discover additional bugs over the bigger course of development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j7ZLjNEOOacaj_HkMwafww.png" /><figcaption>Mocks are easily editable, shareable and modifiable</figcaption></figure><p>We’re also very fond of Pastebin and sharing content with your colleagues, so <strong>mocks are easily shareable</strong>. They’re also <strong>easily editable</strong> — both online (via the simple dashboard) and offline (with a simple text editor or with our <a href="https://github.com/unmock/unmock-vscode-plugin">vscode plugin</a>). Speaking of dashboard, we also make it easy to see mock history (via the dashboard) and relate the different mocks to test suites (via the plugin).<br>Your mocks can also be <strong>stateful</strong>, and once unmocked, your unmocked responses are available for <strong>offline use</strong> as well (although then you can’t simulate the latency of making the request — which is not a bad thing, just something to keep in mind).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JCIZl37vTzX43EKYMW0BLA.png" /><figcaption>Your history is easily accessible from our dashboard</figcaption></figure><p>What’s next? As we grow and maintain a bigger database of APIs (at the moment we don’t really mock the <em>entire</em> internet — <em>yet</em>), we plan to spread out and provide unmock in other contexts. Microservices, API discovery (when no documentation is available), databases and more. Our SDK is available in 3 languages at the moment (JavaScript, Python, Java), and we plan on extending it for other languages as the need arises.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nQszh4uX8jSqJAZMu0iZ6g.png" /><figcaption>A test suite running unmock</figcaption></figure><p>There are a few things that would make us extremely happy:<br>1. Saving your time when coding — test unmock. Play with it, try to break it, give it a shot. <a href="http://www.unmock.io/">It’s free anyway</a>.<br>2. <a href="https://spectrum.chat/unmock">Share your experiences</a> (or favorite memes) with us; let us know how we can improve our product, what you did or didn’t enjoy.<br>3. <a href="/service/mailto:contact@unmock.io">Ping us</a> if you’d like to work with us (we’re also hiring), or just have us in your next meetup! We attend Node and Python meetups quite regularly.</p><p><strong>You code. We mock.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e16c4f339ee3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building isomorphic JavaScript packages]]></title>
            <link>https://medium.com/hackernoon/building-isomorphic-javascript-packages-1ba1c7e558c5?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ba1c7e558c5</guid>
            <category><![CDATA[universal-javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[isomorphic-javascript]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Mon, 28 Jan 2019 13:46:00 GMT</pubDate>
            <atom:updated>2019-01-28T14:19:52.686Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Isomorphic JavaScript Packages</h3><p>I had to look up isomorphic in a dictionary the first time I came across this word in web development. <a href="https://en.wikipedia.org/wiki/Isomorphic_JavaScript">Wikipedia</a> reports that <strong><em>Isomorphic JavaScript</em></strong><em>, also known as </em><strong><em>Universal JavaScript</em></strong><em>, describes </em><a href="https://en.wikipedia.org/wiki/JavaScript"><em>JavaScript</em></a><em> applications which run both on the </em><a href="https://en.wikipedia.org/wiki/Client_(computing)"><em>client</em></a><em> and the </em><a href="https://en.wikipedia.org/wiki/Server_(computing)"><em>server</em></a><em>.</em></p><p>Building a package that works out of the box in both the server (ie Node) and the client (ie a browser) is hard. As soon as you start mixing in dependencies, if even one of them makes a call to a node-only package (think <a href="https://nodejs.org/api/fs.html">fs</a>) or browser-only object (think <a href="https://www.w3schools.com/jsref/obj_window.asp">window</a>) , it will tank your whole build. Worse yet, you may not even be able to reasonably infer this problem exists, as they may be buried in sub-sub-sub-dependencies that have no bearing on the code you are writing.</p><p>This document describes a couple easy conventions for developing isomorphic node packages and ends with one opinionated missive about how they should be packaged.</p><h3>Ignore requires in webpack</h3><p>Even if you use a package like <a href="https://www.npmjs.com/package/detect-node">detect-node</a> to create conditional node vs browser imports, <a href="https://webpack.js.org/">webpack</a> does not care about conditionals because it has no clue how the runtime will resolve them. So, in the following scenario:</p><pre>const foo = isNode ?<br>  require(&quot;fs&quot;) :<br>  require(&quot;fs-web&quot;);</pre><p>it will happily try to package all of the code you require, meaning that in this case, it will try to package fs. It will then fail with the following error message.</p><pre>Module not found: Error: Can&#39;t resolve &#39;fs&#39; in [insert file here]</pre><p>In response to my <a href="https://stackoverflow.com/questions/54274912/webpack-using-node-modules-in-an-isomorphic-package/54276108#54276108">question on how to get around this conundrum</a>, Alex Rokabilis writes:</p><blockquote>[check out] the not very well known __non_webpack_require__ function. This is a webpack specific function that will instruct the parser to avoid bundling this module that is being requested and assume that a global require function is available.</blockquote><p>While <a href="https://webpack.js.org/api/module-variables/">__non_webpack_require__</a> is a documented part of the API, it is buried deep within the documentation, thus its obscurity. However, it works like a charm with one minor tweak.</p><p>If you try to write:</p><pre>const foo = isNode ?<br>  <a href="https://webpack.js.org/api/module-variables/">__non_webpack_require__</a>(&quot;fs&quot;) :<br>  require(&quot;fs-web&quot;);</pre><p>Node will barf with the following error message:</p><pre>__non_webpack_require__ is not defined</pre><p>Typescript will also not recognize __non_webpack_require__.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nuyNVh5c4xjsb9zcdw0xYA.png" /></figure><p>This can be overcome in the following ways:</p><ol><li>For typescript users, require <a href="https://www.npmjs.com/package/@types/webpack-env">@types/webpack-env</a>. Do not use <a href="https://www.npmjs.com/package/@types/webpack">@types/webpack</a> for this, it will not work.</li><li>In your code, somewhere before you use __non_webpack_require__, write the following hack:</li></ol><pre>if (isNode) {<br>  (global as any).__non_webpack_require__ = require;<br>}</pre><p>There are a few different ways to accomplish this, most of which will not raise an error in an IDE and will compile with <a href="https://babeljs.io/">babel</a> and <a href="https://www.typescriptlang.org/">typescript</a> but will fail in your node environment. So use this one — it’s been extensively tested by our team and works.</p><h3>Use dependency injection and TS interfaces</h3><p><a href="https://en.wikipedia.org/wiki/Dependency_injection">Dependency injection</a> is a popular pattern that is famously evangelized by Uncle Bob in <a href="http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html">this article</a> that I’ve mentioned several time on this blog. The idea is that dependencies should always import inwards, meaning that “core” code should never know about dependencies, but should make a contract with the calling code via interfaces, and the calling code implements classes that make good on this contract by, amongst other things, pulling in relevant dependencies.</p><p>In unmock-js, we use dependency injection for the logging and persistence mechanisms, both of which are defined in an options object that is injected into the main unmock function at runtime. If no option is given, sensible defaults are chosen based on the detect-node package, which is the most popular and reliable way to detect if an environment is node or not. Let’s see how that works.</p><p>In our dependency injection, options parameter is defined to contain, amongst other things, the following interfaces:</p><pre>export interface IUnmockOptions {<br>  // ... some stuff, then ...<br>  logger?: ILogger;<br>  persistence?: IPersistence;<br>  // ... more stuff<br>}</pre><p>ILogger and IPersistence themselves contain various methods, such as ILogger::log and IPersistence::saveHeaders, that call functions specific to node or the browser. For example, here is the difference between node and jsdom code for one method in the IPersistence interface:</p><pre>// fs-persistence.ts</pre><pre>export default class FSPersistence implements IPersistence {<br>  public saveHeaders(hash: string, headers: {[key: string]: string})   <br>  {<br>   fs.writeFileSync(`${this.outdir(hash)}/response-header.json`, JSON.stringify(headers, null, 2));<br>  }<br>}</pre><pre>// local-storage-persistence.ts<br>export default class LocalStoragePersistence implements IPersistence {<br>  public saveHeaders(hash: string, headers: {[key: string]: string}) <br>  {<br>    window.localStorage[`${this.outdir(hash)}/response-header.json`] = JSON.stringify(headers, null, 2);<br>  }<br>}</pre><h3>Don’t use separate packages</h3><p>I’ve flipped back and forth on this issue quite a lot. On one hand, using separate packages for different environment solves the “1980s Christmas lights” phenomenon where an error in one environment tanks all of the others. This can, of course, be toxic for package and project management. On the other hand, separate packages can lead to a usability problem if the developer is trying to develop an isomorphic package and now needs to include and manage multiple packages. This is currently the case, for example, with <a href="https://www.npmjs.com/package/@sentry/node">@sentry/node</a> versus <a href="https://www.npmjs.com/package/@sentry/browser">@sentry/browser</a>. If you are developing a <a href="https://nextjs.org/">Next.js</a> package, for example, and are trying to reuse server and client code that relies on <a href="https://sentry.io/">Sentry</a>, this can lead to a huge mess of if / then clauses. I’m sure that Sentry will fix this, but the general problem should be avoided if possible.</p><p>As a result of this philosophy, <a href="https://www.npmjs.com/package/unmock">unmock-js</a> is a single package that works flawlessly across Node and browser environments, even in complicated scenarios that mix code from the two.</p><p>The goal is to ease developer experience so that they have a batteries-included way to start working with mock data as they build out their web app.</p><h3>tl;dr</h3><p>When making isomorphic JS packages:</p><ol><li>Use __non_webpack_require__.</li><li>Use dependency injection.</li></ol><p>Thanks for reading!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ctcvm3UA0dovibwM4CygzQ.jpeg" /><figcaption>Who doesn’t like Morph?!?</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ba1c7e558c5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/building-isomorphic-javascript-packages-1ba1c7e558c5">Building isomorphic JavaScript packages</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Awaiting Python]]></title>
            <link>https://medium.com/hackernoon/awaiting-python-8fd9dbf0df72?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fd9dbf0df72</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[async]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Tue, 27 Nov 2018 04:02:47 GMT</pubDate>
            <atom:updated>2018-11-27T04:02:47.577Z</atom:updated>
            <content:encoded><![CDATA[<p>Python officially introduced async/await back in Python 3.4. However, the original <em>asyncio </em>developers were not part of the documentation process, leading to a plethora of awaitable questions.</p><p>Writing documentation for code you didn’t write yourself it always a tedious process. Unfortunately, more often than not, it also leads to bad documentation. Even Guido van Rossum <a href="https://github.com/python/asyncio/issues/477#issuecomment-269043358">shared his feelings</a> about the lacking documentation for the <em>asyncio</em> module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*HnyPilNkfBcIpTjIOzn3Pg.jpeg" /></figure><h3>Some background</h3><p>A lot has changed since the original, <a href="https://www.python.org/dev/peps/pep-3156/">“provisional” API</a> released in Python 3.4 (back in 2013!). Without going too much into details, the library was made an official part of <a href="https://www.python.org/dev/peps/pep-0492/">Python in version 3.5</a>, and was (is) continuously updated and upgraded with each new release. Unfortunately, backward compatibility means that there are also a bucket-load of misnomers. In turn, this leads to articles such as “<a href="http://lucumr.pocoo.org/2016/10/30/i-dont-understand-asyncio/">I don’t understand Python’s Asyncio</a>”, or “<a href="https://medium.com/@jasongoldstein/im-to-stupid-for-asyncio-ff74809cc84d">I’m too Stupid for AsyncIO</a>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*e1TMei0bnXMCJQk817_23A.png" /></figure><p>While not without its drawbacks, <em>asyncio</em> has proven as an important tool for us at <a href="https://www.meeshkan.com/">Meeshkan.</a> What troubled me, is that in our dev team, I’m probably the one with the least expertise in JavaScript. I come from a machine learning background, from low-level C and OS methodologies. Naturally, when my colleagues were talking about Futures, Promises, and awaiting them, I lowered my head and just took it as “oh well, some web talk again”.</p><p>However, if you’re anything like me and you lack general experience with the async/await pattern from languages <strong>built</strong> for asynchronicity, then follow me while I try to explain my key takeaways from <em>asyncio</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*TesOZmlxRWkeBhh-2_lPMw.png" /></figure><h3>But why</h3><p>Python offers threading and multiprocessing out of the box, from way back in the day. For OS-oriented people, this sounds very attractive. While multiprocessing is often an overkill and introduces a more difficult problem of inter-process communication, <a href="https://glyph.twistedmatrix.com/2014/02/unyielding.html"><em>threading</em> vs <em>asynchronicity</em></a><em> </em><a href="https://stackoverflow.com/questions/4024056/threads-vs-async">seemed</a> <a href="https://codewala.net/2015/07/29/concurrency-vs-multi-threading-vs-asynchronous-programming-explained/">like a</a> <a href="https://www.quora.com/What-is-the-difference-between-asynchronous-programming-and-multi-threading">reasonable</a> <a href="https://stackoverflow.com/questions/15148852/async-await-vs-threads">debate</a> (in many languages). It’s important to note — threading in Python is not OS-level threading. It’s user-level, or in other words — there’s only ever <strong>one true Python thread</strong> running, exchanging it’s own internal “threads”. It’s further <a href="https://opensource.com/article/17/4/grok-gil">complicated by the GIL</a> (<strong>G</strong>lobal <strong>I</strong>nterpreter <strong>L</strong>ock; also highly recommended link for all Pythonistas), for which tl;dr — you have no control over which thread will be running in any given moment, effectively wasting time on idle threads. Abu Ashraf Masnun summarized all these perfectly in his <a href="http://masnun.rocks/2016/10/06/async-python-the-different-forms-of-concurrency/"><em>Async Python: The Different Forms of Concurrency</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*G93vt6VRasohfOery4AKQQ.png" /></figure><h3>The different elements</h3><p>After that long introduction, let’s get down to it. Fast, because we’re all tired here and we came here for a reason. Let’s define the following concepts:<br><strong>- Event Loops:</strong> These are your drivers. They allow juggling between the different tasks.<br><strong>- Coroutines:</strong> Your “async method” generators. They generate these asynchronous methods when <em>called upon</em>. Personally, they remind me of decorators, with a more confusing syntax.<br><strong>- Tasks: </strong>Your very own asynchronous scheduler. In other words, once you have an event-loop, you’d probably want to schedule things for it to run. Once you schedule them, they become <em>tasks</em>.<br><strong>- Future: </strong>An object whose goal it is to synchronize things again once the <em>task</em> is done. It’s a temporary object that will: 1) hold on to the result of the <em>task </em>once it’s done and 2) will report to any callback method you want, once it is done. A <strong>Task</strong> is a some kind of <strong>Future </strong>(bam, we only have to care about 3 elements instead of 4!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*o8_J0OCUyL_SDF6r6EeXNA.jpeg" /></figure><h3>Yes yes, but I need code to understand</h3><p>Of course you do — we all do. I sure as hell needed it.</p><p>But there are plenty of “how to” example, exemplifying the use of different <em>asyncio </em>methods. Personally, I felt like those show a good idea on how to use these functions in a broad sense, but lack explaining what each individual code line actually does. Hence — let’s look into some common and important method calls.</p><p><strong>Event loop handling functions</strong> include:<br>asyncio.get_event_loop() will return the event loop currently running in the thread. If no such event loop exists — it will create one for you. However, this functionality seems to only work on the main thread at the moment, so for any new threads (if you want to support multiple event loops), you will have to use …<br>asyncio.new_event_loop() followed by asyncio.set_event_loop() to create and set a new event loop for any non-main threads. I would carefully question the need for additional event loops, as there is only one true Python thread. Separating event loops within threads might make sense when your application starts growing out of control — it might be easier to batch off event loops and their respective tasks — but more often than not, this is not the case. The downside is that you have to communicate which event loop to use when using threading and <em>asyncio</em> with a single event loop. Once a loop exists, we can run it forever (until stopped with loop.stop()) with loop.run_forever(). Note, however, than run_forever()<strong> is a blocking statement</strong>.</p><p>Finally, once we’re done with our event loop, we can close it with loop.close(). We can also ping relevant information via self-explanatory methods such as loop.is_running() and loop.is_closed(). We’ll get to running stuff with our loop very soon — I promise.</p><p>Coroutines, as mentioned, are simply functions that return.. well, a function. Reminds me of decorators, more than generators. They are defined just like any normal method in Python, except with the additional async prefix, a la async def my_first_coroutine(arg1, arg2, *args, **kwargs). Notice however that much like decorators, once called, this will return a simple <strong>coroutine object</strong>, which we can use in the event loop.</p><p>What can we do with a coroutine object you may ask?<br>First, inside any coroutine function we may use await. await effectively <em>blocks</em> our function from progressing, and tells the event loop that other tasks can run meanwhile. The event loop will keep track of when this await statement is done… waiting. <strong>This is important because </strong><strong>await cannot be used outside of coroutine objects/functions!<br></strong>Next, we can finally use our event loop to run something! Using loop.run_until_complete(...). This also <strong>blocks</strong>, until the coroutine ends. It’s like using await outside of a coroutine function. However, run_until_complete is designed for <em>tasks</em>, and coroutine objects are implicitly converted to tasks when used this way. So let’s talk about…</p><p>Tasks. Tasks are, in my inexperienced opinion, the building blocks for <em>asyncio</em>. The most convenient way to create a proper task object is by 1) getting your loop event and 2) using loop.create_task(coroutine_object). This assigns the coroutine object to the event loop, schedules it to run (i.e. once a loop has been run_forever(), this is one way to assign tasks to it), and returns a task object which you can task.cancel() at any point.<br>Additionally, tasks offer similar methods to Future, supporting done(), result(), and most importantly — add_done_callback(callback), allowing you to initiate synchronous methods once the task is done. Your callback will be called with the result as an argument. Unlike Future, you cannot set_result(), because the result is set by the coroutine.</p><p>We’ve covered the important stuff and so far, to me, this feels like <em>an-almost-complete-guide-for-the-inexperienced. </em>We should cover several more nuances before we go to the wild and read asyncio examples.<br><strong>Q: What if I want to call a synchronous function with </strong><strong>asyncio?</strong><br><strong>A:</strong> You can add synchronous function calls using loop.call_* methods. These include loop.call_soon(callback, *args), loop.call_later(delay, callback, *args), loop.call_at(when, callback, *args). If you want to call a synchronous function from a different <em>thread</em>, use the thread-safe option: loop.call_soon_threadsafe(callback, *args).<br><strong>Q: My coroutine itself has blocking call! What do I do?</strong><br><strong>A: </strong>If your coroutine has a blocking call, the event loop will also block. We have to use… you guessed it, another thread. The seams between the two (async and threads) are nigh endless. Long story short, you can schedule such a coroutine to run with a different thread with loop.run_in_executor(None, func, **args). This will return a Future object, which you can use to check done(), result() and of course cancel() and add_done_callback(callback). <br>With run_in_executor, you can also use await (it’s an asynchronous run after all!) to block your code from continuing, but not block your event loop from running. I have my own discontent about the way run_in_executor is formed, but then again, I guess <a href="https://en.wikipedia.org/wiki/Wikipedia:If_it_ain%27t_broke,_don%27t_fix_it">if it ain’t broke, don’t fix it</a>.<strong><br>Q: What if I want to use keywards arguments for my functions?<br>A: </strong>The documentation continuously points to functools.partial as the answer.<br><strong>Q: I’d like to use asyncio but that requires overhauling all of my code!</strong><br><strong>A:</strong> That’s sometimes referred to as the <em>async creep</em>. Christian Medina covers it wonderfully in his article “<a href="https://hackernoon.com/controlling-python-async-creep-ec0a0f4b79ba">Controlling Python Async Creep</a>”.<br><strong>Q: Great, where do I go from here?<br>A: </strong>I recommend also checking out Medina’s “<a href="https://hackernoon.com/threaded-asynchronous-magic-and-how-to-wield-it-bba9ed602c32">Threaded Asynchronous Magic and How To Wield It</a>” for some code examples. The <a href="https://docs.python.org/3/library/asyncio-dev.html">dev page</a> from Python’s API on asynchronicity for some pitfalls and tips. For more complete theory and thoughts about asynchronous programming in Python, check out Nick Coghlan’s “<a href="http://python-notes.curiousefficiency.org/en/latest/pep_ideas/async_programming.html">Some Thoughts on Asynchronous Programming</a>”.<br>Then have a look at <a href="https://tutorialedge.net/python/concurrency/asyncio-event-loops-tutorial/">Asyncio Event Loops Tutorial</a> for some brief examples, “<a href="https://medium.freecodecamp.org/a-guide-to-asynchronous-programming-in-python-with-asyncio-232e2afa44f6">A guide to asynchronous programming in Python with asyncio</a>” once you feel more competent (includes easy-to-consume examples), and finally, have a look at <a href="https://cheat.readthedocs.io/en/latest/python/asyncio.html">Dan’s Asyncio Cheatsheet</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*UfyD0cCZGPST4pjd-AqK8A.jpeg" /></figure><p>I hope with these in mind, <em>asyncio</em> is perhaps a bit clearer. There are great online guides, but it seemed most of them were either directed for people with web background, or tried to encapsulate previous iterations of <em>asyncio</em>. Most importantly, I really just hope you’ve gained something from these, even if only some links and a few smirks from the memes.<br>Go on and checkout the <a href="https://docs.python.org/3/library/asyncio.html">Python asyncio API</a> now, if you dare.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fd9dbf0df72" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/awaiting-python-8fd9dbf0df72">Awaiting Python</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Never mock an API again]]></title>
            <link>https://medium.com/hackernoon/never-mock-an-api-again-daac4a15d105?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/daac4a15d105</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[jasmine]]></category>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[unit-testing]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Wed, 21 Nov 2018 06:13:16 GMT</pubDate>
            <atom:updated>2018-11-24T22:43:24.314Z</atom:updated>
            <content:encoded><![CDATA[<h4>Why we use unmock for our full stack</h4><p>Let’s face it, mocking sucks. Every programming language and platform has different tools to help you mock API calls, but all of them share some common fragilities:</p><ul><li>No clean way to verify if the mocks are correct representations of the API.</li><li>No way to avoid reverse engineering the API you’re mocking.</li><li>No way to quickly mock internal APIs.</li><li>No way to monitor in production if the mocks from your tests resemble the data that you’re getting back in the wild.</li></ul><p>As a result, teams lose tons of time and energy writing mocks for their unit and integration tests, which leads to buggy tests, less test coverage, and ultimately a less reliable production environment.</p><h3>unmock</h3><p>Enter <a href="https://unmock.io/">unmock</a>. Unmock is great because it basically takes care of all of this stuff for you. There is a good YouTube overview of the service (currently in closed beta), but I thought I’d walk you through how unmock speeds our team up at Meeshkan.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DN__WWn8UeZ0&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FN__WWn8UeZ0%3Ffeature%3Doembed&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/94186741a165d6362a1a2482b29474c8/href">https://medium.com/media/94186741a165d6362a1a2482b29474c8/href</a></iframe><p>The first important thing to know about unmock is that the amount of test code you write reduces drastically because you are not rolling your own mocks. In Meeshkan, we basically deleted all of our mocking code, including the logic that tied it together, and used unmock as a drop in replacement for our API calls. Tweaking the mocked responses is really intuitive, and as a result, we’ve been able to quickly write corner-case tests for all sorts of bad API calls — unexpected nulls, empty strings, etc. We’ve also spotted several incorrect assumptions about the APIs we’re using, which is a real life saver when you’re trying to build a product fast.</p><p>One feature we particularly appreciate is the way unmock deals with API calls in the same test. Basically, by clicking on “Parent” on app.unmock.io, you can go backwards in time over your mocks to see really quickly the data that is coming into your tests. Of course, you can modify all of this in a jiffy to tell the story you want to tell through your tests.</p><p>While unmock offers a save feature to download mocks locally, we actually find that this is the least useful feature of the product. At first, we were checking our mocks into version control, but we quickly realized that it is far better to have the mocks live on unmock for a variety of reasons. The main one is that you don’t have to worry about which mocks are made locally and which ones are pulled from unmock as you add more and more calls to your tests — you have a single source of mocks. Also, for graphql schemas, unmock will automatically update the schema as it is published, which avoids freezing stale mocks. Another killer feature is unmock’s production monitoring: if you get mocks from the unmock API, it will automatically track what data your API calls are seeing and then know, in production, if any of this data is off — missing, skewed, whatever.</p><p>Unmock has quickly moved to the center of our testing stack across multiple platforms — Android, iOS, and Web — so that we can build accurate tests fast without worrying about dreaded 401 errors and bugs that come from reverse engineering vendor code in your tests. Try to get in on the <a href="https://app.unmock.io/">beta</a> if you can!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*98_YBWwwLVTER6WQvpUIdQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=daac4a15d105" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/never-mock-an-api-again-daac4a15d105">Never mock an API again</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Forgetting to set environment variables in nodejs apps]]></title>
            <link>https://medium.com/hackernoon/forgetting-to-set-environment-variables-in-nodejs-apps-1f45ff113ce5?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f45ff113ce5</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[environment-variables]]></category>
            <category><![CDATA[tslint]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[meeshkan]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Tue, 20 Nov 2018 17:29:25 GMT</pubDate>
            <atom:updated>2018-11-20T17:29:25.172Z</atom:updated>
            <content:encoded><![CDATA[<h4>tl;dr yarn add --dev faceplant</h4><p>You’ve developed your killer express app. It’s passing unit tests, integration tests, end-to-end tests... You’re so content that you print the code out and pin it to your fridge. You deploy to production, but in a few hours, you get complaints that the service is more or less completely useless. You dig through debug logs, but to no avail — there’s nothing obviously wrong, and tests are passing, so your users must just be exaggerating. All of them.</p><p>Or maybe you forgot to set an environment variable in production.</p><p>From my experience, this is the #1 source of service failure in well-tested production apps, and this has reared it’s ugly head at Meeshkan as well.</p><p>To fix this, we made <a href="https://github.com/Meeshkan/faceplant">faceplant</a>, a TSLint plugin for production workloads. The goal is to replace start commands like ts-node dist/server.ts with things like tslint --project . &amp;&amp; ts-node dist/server.ts so that a linting step is done on the production environment and the service will fail fast if the lint check doesn’t pass.</p><p>The first rule in this package, no-unset-env-variables, allows you to check to make sure that your env variables are set in both dev and production environments. There are options for reading from an .env file or using the actual environment. You can even have it check for variables not present in your code. All this adds up to safer production code and a more pleasant development experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jghuaY17zF8MbE7eKY2RAw.gif" /><figcaption>Ah, linting. Saving Meeshkan’s production environment since 2018.</figcaption></figure><p>If you’ve never developed a TSLint plugin before, it’s dead easy. We used this <a href="https://github.com/eranshabi/tslint-custom-rules-boilerplate">great boilerplate</a> to get started and figured out how to make it production-ready by following the conventions in <a href="https://github.com/cartant/rxjs-tslint-rules">this repo</a>.</p><p>Otherwise, when in doubt, use <a href="http://i-forgot-to-set-my-env-variable.com/">http://i-forgot-to-set-my-env-variable.com</a>.</p><pre>axios.get(process.env.API_URL || &quot;http://i-forgot-to-set-my-env-variable.com&quot;)</pre><p><a href="https://github.com/Meeshkan/i-forgot-to-set-my-env-variable">Pull requests</a> welcome!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*cw9DMYzq0vQFikMkHTXzJg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f45ff113ce5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/forgetting-to-set-environment-variables-in-nodejs-apps-1f45ff113ce5">Forgetting to set environment variables in nodejs apps</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using graphqlgen for our cloud stack]]></title>
            <link>https://medium.com/hackernoon/using-graphqlgen-for-our-cloud-stack-ae30c4b017a1?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae30c4b017a1</guid>
            <category><![CDATA[cloudstack]]></category>
            <category><![CDATA[tech-stack]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[apollo-server]]></category>
            <category><![CDATA[graphqlgen]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Tue, 13 Nov 2018 09:56:01 GMT</pubDate>
            <atom:updated>2018-11-13T09:56:01.730Z</atom:updated>
            <content:encoded><![CDATA[<h4>TL;DR — Apollo Server &amp; Typescript ⇒ graphqlgen</h4><p>At Meeshkan, we were writing our own typescript interfaces for JS object representations of our GraphQL schema, which proved to be error-prone and laborious.</p><p>The new <a href="https://github.com/prisma/graphqlgen">graphqlgen</a> package by <a href="https://prisma.io/">Prisma</a> makes that crazy easy, but if you are not comfortable with GraphQL schemas yet, it can feel like another layer of incomprehension in an already incomprehensible stack. I wanted to take a moment to share a few key learnings from working with this new tool in case you are struggling to get started:</p><ul><li>How resolvers in Apollo Server actually work.</li><li>Why graphqlgen is awesome.</li><li>Why you should <em>never</em> use prisma types for your server’s schema’s types.</li><li>Bonus: How to unit your test resolvers.</li></ul><h3>How resolvers work in Apollo Server</h3><p>Before you can work with graphqlgen effectively, you need to understand the basics of how resolvers work in Apollo Server.</p><p>The main thing that helped me in grocking resolvers was to learn how they cascade, not unlike redux reducers. The <a href="https://www.apollographql.com/docs/apollo-server/essentials/data.html">documentation</a> from Apollo Server is a helpful start, but I couldn’t quite figure out how everything tied together I concocted a bad example showing the problem they’re trying to solve.</p><p>Let’s assume that your schema is:</p><pre>type User {<br>  id: ID! @unique<br>  posts: [Post!]!<br>}</pre><pre>type Post {<br>  id: ID! @unique<br>  author: User!<br>}</pre><pre>type Query {<br>  user(id): User<br>}</pre><p>One (bad) way you could write your resolvers is like this:</p><pre>export const Query: MyQueryResolverType = {<br>  user: async (_, { id }, __) =&gt; {<br>    const user = await getUserFromDatabase(id); // fetch user<br>    const posts = await getUserPostsFromDatabase(id); // fetch posts<br>    return {<br>       ...user,<br>       posts,<br>    }<br>  }<br>}</pre><pre>export const User: MyUserResolverType {<br>  id: ({ id }, _, __) =&gt; id,<br>  posts: ({ posts }, _, __) =&gt; posts,<br>}</pre><pre>export const Post: MyPostResolverType {<br>  id: ( { id }, _, __) =&gt; id,<br>  author: ({ author }, _, __) =&gt; author,<br>}</pre><p>There are numerous problems with the code above: we have had to write our own types for resolvers like MyQueryResolverType, MyUserResolverType and MyPostResolverType. graphqlgen will take care of these for us, which we’ll see in a bit, but for now we’re stuck with that fragility.</p><p>The main problem for this section is that the user query is doing both too little and too much work. We have no clue if the incoming graphql query is going to even ask for the posts, so why would we fetch them here? Furthermore, if the person does something like:</p><pre>{<br>  user(id) {<br>    posts {<br>      author {<br>        posts {<br>          author {<br>            id<br>          }<br>        }<br>      }<br>    }<br>  }<br>}</pre><p>…this will break, as it won’t recurse down the tree. So let’s fix it with proper resolvers.</p><pre>export const Query: MyQueryResolverType = {<br>  user: (_, { id }, __) =&gt; getUserFromDatabase(id); // a promise<br>}</pre><pre>export const User: MyUserResolverType {<br>  id: ({ id }, _, __) =&gt; id,<br>  posts: ({ id }, _, __) =&gt; getPostsFromUser(id), // a promise<br>}</pre><pre>export const Post: MyPostResolverType {<br>  id: ({ id }, _, __) =&gt; id,<br>  author: ({ id }, _, __) =&gt; getUserFromPost(id); // a promise<br>}</pre><p>And no more breakage. ApolloServer traverses down the tree, calling the correct resolver as needed. This is because the first argument passed in to the resolver function is the representation of the object returned from the previous resolver, which we use to get important information about the object like the id. In the ApolloServer documentation, this object is called parent, which I think is a poor choice for a name. I would opt for partial_obj or obj_hint or obj_with_stuff_missing.</p><h3>Why graphqlgen is awesome</h3><p>The “good” example above has (at least) two pesky anti-patterns: the Resolver type needs to be written by hand, and there are functions like Post.id that are basically identity functions. graphqlgen fixes this. It will automatically generate Typescript interfaces for resolver types <em>and</em> default resolvers for resolvers. Goodbye boilerplate!</p><p>To use graphqlgen, simply include a graphqlgen.yml file in your root directory, yarn add --dev graphqlgen and then npx graphqlgen somewhere in your build to generate the goods. The graphqlgen.yml file has, at the time of this writing, six keys that we use, all of which are pretty self-explanatory:</p><pre># The target programming language for the generated code<br>language: typescript</pre><pre># The file path pointing to your GraphQL schema<br>schema: ./src/schema.graphql</pre><pre># Type definition for the resolver context object<br># The context object is passed into ApolloServer.<br># It usually contains stuff like a database connection<br># or user id or whatever.<br>context: ./src/types.ts:IContext</pre><pre># Find TS models that correspond to the graphql schema and map them<br># NOTE: this part is tricky and is the subject of the next section,<br># so read on to find out more.<br>models:<br>  files:<br>    - path: path/to/my/resolver/types.ts<br>      defaultName: &#39;I${typeName}&#39; # my convention<br>    - path: path/to/my/generated/prisma/types<br>      defaultName: &#39;${typeName}Node&#39; # prisma convention</pre><pre># Where all of this boilerplate code is written<br>output: ./src/generated/graphqlgen.ts</pre><pre># In case you need inspiration for your resolvers, this generates<br># stubs that you can fill in<br>resolver-scaffolding:<br>  output: ./src/generated/tmp-resolvers/<br>  layout: file-per-type # one file per type in the </pre><p>Now, if we revisit our previous example, things get a whole lot easier to follow:</p><pre>export const Query: QueryResolvers.Type = {<br>  user: (_, { id }, __) =&gt; getUserFromDatabase(id); // a promise<br>}</pre><pre>export const User: UserResolvers.Type {<br>  ...UserResolvers.defaultResolvers,<br>  posts: ({ id }, _, __) =&gt; getPostsFromUser(id), // a promise<br>}</pre><pre>export const Post: PostResolvers.Type {<br>  ...PostResolvers.defaultResolvers,<br>  author: ({ id }, _, __) =&gt; getUserFromPost(id); // a promise<br>}</pre><p>All of the resolver types are hanging out in src/generated/graphqlgen, and we no longer need to roll our own. Furthermore, default resolvers are generated for every type, so we no longer need to write all that boilerplate. Sweet!</p><h3>Why you should <em>never</em> use prisma types for your server’s schema’s types</h3><p>Prisma is fantastically efficient. So efficient that you will just want to ping your database from your client using GraphQL and dispense of Apollo Server entirely. This is tantamount to reading and writing to a database directly from a web page which is, in short, a very bad idea.</p><p>Now that graphqlgen is around, it is even more expedient to create an Apollo Server in record pace, and in doing so, you may be tempted to use the interfaces generated by Prisma as the interfaces representing types in your schema. This is also a bad idea. For example, let’s imagine that your prisma datamodel.prisma contains:</p><pre>type UserNode {<br>  id: ID! @unique<br>  email: String!<br>  internalFieldUsedByDevs: String!<br>  anotherInternalField: String!<br>}</pre><p>whereas our schema.graphql contains:</p><pre>type IUserNode {<br>  id: ID! @unique<br>  email: String<br>}</pre><p>If you do not want internalFieldUsedByDevs and anotherInternalField to be reachable by your client, you probably do not want the same Typescript type as prisma generates. The more sensible alternative would be to write your own type and use that. No problem, except how does graphqlgen know how to use yours and not prisma’s? Let’s go back to graphqlgen.yml.</p><pre>models:<br>  files:<br>    - path: path/to/my/resolver/types.ts<br>      defaultName: &#39;I${typeName}&#39; # my convention<br>    - path: path/to/my/generated/prisma/types<br>      defaultName: &#39;${typeName}Node&#39; # prisma convention</pre><p>Here, <strong>order matters</strong>. graphqlgen will first use the types in types.ts and then try to get whatever it does not find from the generated prisma types. That way, Query.me will correctly be documented and type-checked as the IUserNode that we wrote and not UserNode generated by prisma.</p><p>While this seems trivial at first, as your server schema and prisma schema start to diverge, you will wind up in situations where your server schema is not a strict subset of your prisma schema. Thus, separating the two will become essential, and it’s better to get in the habit of enforcing that early.</p><h3>Bonus: How to unit test your resolvers</h3><p>Doesn’t really have anything to do with graphqlgen, but hey, since we’re talking about writing resolvers, let’s not forget to test them!</p><pre>import * as request from &quot;supertest&quot;;<br>import app from &quot;../../path/to/my/express/app&quot;;</pre><pre>const ENDPOINT = &quot;/graphql&quot;;</pre><pre>test(&quot;test hello&quot;, async () =&gt; {<br>  const { text } = await request(app)<br>      .post(ENDPOINT)<br>      .send({query: &quot;{ hello }&quot;});<br>  expect(JSON.parse(text).data.hello).toBe(&quot;Hello!&quot;);<br>});</pre><p>Underwhelming, I know, but the cleanest things often are. As I couldn’t really find anything online that stated this this succinctly, I thought I’d put it here.</p><p>This assumes that you have set up an express app in a separate file from your server so that you don’t have to start and stop the server for each test, which can lead to all sorts of wacky port-related errors.</p><p>We’re using Jest at Meeshkan, but mocha or really anything is fine. At some point, you’ll need to mock your database communication object (in our case, the prisma instance generated by prisma generate), which is pretty straightforward on any of these platforms.</p><p>So there you have it! Almost-painless type checking, default resolver scaffolding and unit testing. w00t!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*x1G3EqT6WQ1uQ4BMvIFmTQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae30c4b017a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/using-graphqlgen-for-our-cloud-stack-ae30c4b017a1">Using graphqlgen for our cloud stack</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[On Great Design — Interview with Dominic Sebastian from Qwilr]]></title>
            <link>https://medium.com/@meeshkan/on-great-design-interview-with-dominic-sebastian-from-qwilr-edeac32c25ba?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/edeac32c25ba</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[qwilr]]></category>
            <category><![CDATA[meeshkan]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Sat, 30 Jun 2018 04:33:40 GMT</pubDate>
            <atom:updated>2018-06-30T04:33:40.750Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.meeshkan.com/">Meeshkan</a> is currently looking for its first designer. As part of that process, we’ve written the <a href="https://pages.qwilr.com/Designer-8Rz9jEgURwej">Designer</a> job post on Qwilr. And this <a href="https://pages.qwilr.com/Machine-Learning-Researcher-pZiBniGLSBOE">ML Researcher</a> post. And this <a href="https://pages.qwilr.com/React-developer-xphLeVCRC6YR">React Developer</a> post. And this <a href="https://pages.qwilr.com/Community-Coordinator-cpo3l1UR2y94">Community Coordinator</a> post. You get the idea :-)</p><p>We fell in love with Qwilr’s design, so we started using it to drive our B2B sales as well. We used it to plan our <a href="https://pages.qwilr.com/Retreat-06-06-cPfx1cRmCZSI">company retreat</a>. We liked it so much that we wanted to pick their brain about how they approach design. I’m pleased to share with you our interview of <a href="https://twitter.com/dominosebastian"><strong>Dominic Sebastian</strong></a> from <a href="https://qwilr.com/"><strong>Qwilr</strong></a>, who shared several great tips for finding and working with a designer. Especially if you are a team of non-visually-oriented nerds (like us), this is a must-read.</p><h3>Hey Dominic! Can you tell us a bit about yourself?</h3><p>Hey Mike. I’m the Design Lead at Qwilr, working on our product and brand, based in Sydney. Originally from London, I actually studied Industrial Design at uni, but after designing a neonatal ventilator for a medical company in my final year (and seeing how much impact a poorly designed interface can have), I made the move into designing digital products. I’ve been working to mature design at startups ever since, from augmented reality studios, to edTech, now to Qwilr.</p><h3>How did you find Qwilr? Or did Qwilr find you? Or are you Qwilr?</h3><p>Haha I am <em>not</em> Qwilr. I met Dylan (our CEO and co-founder) pretty soon after I landed in Sydney in 2014. We met through a design forum, went for a coffee, and stayed good friends since. The opportunity came up last year to join as their first design hire, and I really wanted to work with him and the team we have here, so I made the move shortly after that.</p><h3>What general lessons have you learned at Qwilr when recruiting and hiring designers? How do you keep them happy to stay on board?</h3><p>We’re still in the process of hiring for this ourselves, but I think what generally keeps designers happy is the same thing that keeps anyone happy. People want to be solving interesting and challenging problems, and to feel like their voice is heard. The kicker with designers I think getting a good rhythm of work between quick frequent change, and longer term big bets. Starting from scratch or redoing a feature can be fun and liberating, but not shipping frequently enough is an easy way to feel like their work isn’t valued.</p><h3>What is a good way for non-designers to interview designers?</h3><p>I think it depends on what kind of designer you’re hiring for and where you see them fitting into your current team, but maybe to rephrase the question slightly I’d say the real question here is “how do I know a designer is also good as a non-designer”.</p><p>I think broadly speaking you want to ask questions that get to the root of why they made certain decisions in their work, and how clearly they can articulate their approach without jargon. If you’re hiring your first designer, you especially want to understand how autonomous they are in a non-design team and company, and if they need someone with more experience and guidance in order to succeed.</p><p>A useful question I’ve always liked to ask is “how would you explain a design decision to a non-designer?” Even in something like a really visual design field normally governed by “taste”, good designers will be able to explain their decisions in a tangible way that others can understand. If they default to the “they don’t get it because they aren’t designers“ attitude, it’s a big red flag for me.</p><h3>In addition to beautiful design, Qwilr has beautiful UX and a flawless site. How do you make sure good design gets translated into a great product?</h3><p>Thanks, accessible and engaging design is something we very consciously strive to create, and are constantly try to improve.</p><p>Starting with good design, I think so much of the hard work is focussing on and solving the right problem. Like it doesn’t matter how good the veneer is if no one finds it valuable. It might buy you some initial interest, but they won’t stick around. So to create great features, I’d focus on getting this initial phase right, by including users at every step of the design process. From initial interviews to dig deeper into a problem they’re having, to early design feedback, all the way through to functional beta testing groups. This helps ensure your designs are solving a real problem, and it’s something the people you’re creating for actually value.</p><p>In terms of getting this design “intention” built, having a well organised design system is really valuable. Both so you’re not wasting time rebuilding common components, but also so in time the product team have a shared language around what they are building. Getting it to take hold so it really manifests into the engineering process takes time, but it’s really worth it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NhRjO2RRP5C8r_n0u7yHhA.png" /><figcaption>Meeshkan uses Qwilr because it is effortlessly responsive, and we know that most of our Qwilr assets are read on mobile devices.</figcaption></figure><h3>Qwilr is a great product now, but it must have become that way through small progress towards your goal. How have designers participated in that journey? What was the most difficult part of the journey for designers pre-launch?</h3><p>This one actually goes well before my time, but for most of the companies existence Dylan (our co-founder and CEO) was it’s only designer, and in the early days its only engineer. Directly because of this, Qwilr has been built on the premise that both need to work together and excel to build a great product people really value.</p><p>I think the most difficult part of anything pre-launch is the tendency to want to endlessly polish things before people can use them, and making sure you’ve had plenty of feedback from use beforehand (we’ve written a bit more about this in our <a href="https://pages.qwilr.com/Qwilr-Principles-gTndRdDyT7mY">Principles</a>). If it’s launch day and that’s the first time you’ll be getting feedback, you’re gunna get a lot of unwanted surprises.</p><h3>At a basic level, let’s say a feature request comes in, or someone has an idea, or something plain doesn’t work? How and when do you work with your designers from inception to production on a new bit of Qwilr?</h3><p>Qwilr is broken down into a few multi-disciplinary teams, each focussed on tackling a specific problem. For example we have a team dedicated to making Qwilr really valuable for teams and collaboration, another for helping people find what they’re looking for after signing up in their first visit to the app. Each of these surface ideas and improvements contextual to their team’s goals, and designers work to see which improvements are quick wins, and which should be rolled up into a larger features.</p><p>Outside of this we also have a stellar support team, which helps surface pain points customers are having, bugs in the app, and the common “I wish it did this!” kinds of feedback. We evaluate things on a case-by-case basis(depending on how they fit into our product vision), but if you can get that feedback loop smoothly running between customers → support team → product you’ve got a machine for really fine tuning a product people love.</p><h3>Beyond your website, in what way do other immaterial assets (banners, ads, etc.), physical assets (posters, swag), abstract entities (colors, textures), artistic inspirations and physical objects play into the design journey?</h3><p>Outside of the core product and our website, we don’t really create any other design or print collateral for Qwilr. Whilst we don’t have anything formal setup for drawing from other mediums in our design process, as a team and a company we all have quite varied interests and backgrounds. It’s a romanticised view of design, but I’ve found the best inspiration to be from someone who has a deep knowledge in something I know nothing about, rather than searching through Behance or Dribbble. That’s not to say they are bad ways to get inspired (they are great ways to get energised at the beginning of a project), but it’s really easy to get visual fatigue doing that.</p><p>Anecdotally though, I read a fair amount of magazines and print publications outside of work (Monocle, New York Times Magazine and Offscreen personal favs). Almost ironically now I’m working at Qwilr, but I still find great editorial design some of the most interesting ways to approach layout and visual rhythm. Sometimes when I’m stuck, I’ll take a walk and flick through something till the problem I’m trying to solve clicks into place.</p><h3>Is there anything I should have asked but didn’t? Any parting shots?</h3><p>Nothing comes to mind. But shameless plug, we’ve now got a free starter plan for Qwilr, so everyone should try it out here 👉 <a href="http://www.qwilr.com/">www.qwilr.com</a>. We’re always looking for <a href="https://qwilr.com/jobs/">great people to join our journey too</a>.</p><p>****************<br>See you all soon with a report of our latest hack — an <a href="https://play.google.com/store/apps/details?id=com.meeshkan.arctic15investor2018">Investor Detector</a> app on Google Play. Yes, we have no shame. Until then, <a href="https://www.meeshkan.com/">keep (machine) learning</a>. And use Qwilr!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tW8VZtMKE2Sys9CGUocaNg.jpeg" /><figcaption>From our retreat — Finland’s awesome!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edeac32c25ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fenced code tabs in mkdocs material]]></title>
            <link>https://medium.com/hackernoon/fenced-code-tabs-in-mkdocs-material-a7951a9f8738?source=rss-af095ee17e3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7951a9f8738</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[meeshkan]]></category>
            <category><![CDATA[mkdocs-material]]></category>
            <category><![CDATA[mkdocs]]></category>
            <category><![CDATA[fenced-code-tabs]]></category>
            <dc:creator><![CDATA[Meeshkan ML]]></dc:creator>
            <pubDate>Mon, 23 Apr 2018 15:29:41 GMT</pubDate>
            <atom:updated>2018-04-23T15:29:41.466Z</atom:updated>
            <content:encoded><![CDATA[<p>Ah, another beautiful spring morning in Helsinki. The birds are singing, the drunks are leaving the bars, and I have given myself 30 minutes to write an appallingly ugly hack to get fenced code tabs working in mkdocs material.</p><p>I made this hack because there seem to be several people that <a href="https://github.com/squidfunk/mkdocs-material/issues/434">really need the feature</a> and yet no one has stepped up to do anything about it. The hack is provisional — I’m sure there are 100s of cleaner ways to do it, but this gets the job done!</p><p>First, I grabbed <a href="https://github.com/yacir/markdown-fenced-code-tabs">markdown-fenced-code-tabs</a>, which more or less works in several mkdocs themes but fails in mkdocs material.</p><p>Scouring the internet for how to fix this, I found a promising lead on <a href="https://github.com/yacir/markdown-fenced-code-tabs/issues/8">this GitHub issue</a>. So the CSS styling works, but when one clicks on the tabs, nothing happens. Digging into the HTML, I realized that all of the aria stuff doesn’t work for reasons beyond my understanding.</p><p>Nothing that a quick JavaScript hack can’t fix…</p><p>First, in your mkdocs.yml, add:</p><pre>extra_javascript:<br>  - javascript/tabhack.js</pre><p>Then, swallow your pride and include:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3980f01ed16063cac0383b5f64a7a5b2/href">https://medium.com/media/3980f01ed16063cac0383b5f64a7a5b2/href</a></iframe><p>And there you go!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*GIXd1KOyRMcuwSQ6GkxZ8Q.gif" /></figure><p>Fun times, fun times…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7951a9f8738" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/fenced-code-tabs-in-mkdocs-material-a7951a9f8738">Fenced code tabs in mkdocs material</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>