<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <author>
    <name>Binyamin Green</name>
    <uri>https://binyam.in</uri>
  </author>
  <icon>/_astro/logo.CnbJfLTy.png</icon>
  <id>https://binyam.in/p</id>
  <link href="https://binyam.in/p/feed.xml" rel="self"/>
  <link href="https://binyam.in/p" rel="alternate"/>
  <subtitle>Archived musings on code, the web, and passing thoughts.</subtitle>
  <title>Binyamin's Blog</title>
  <updated>2023-03-16T23:15:55.787Z</updated>
  <entry>
    <content type="html">
      <![CDATA[<p>On Mastodon, <a href="https://matthiasott.com/">Matthias Ott</a>
<a href="https://mastodon.social/@matthiasott/110033938136836091">asked</a>,
<q cite="https://mastodon.social/@matthiasott/110033938136836091">What
information do you include in the README of a web project? Any great examples
you can think of? Do you use a template? Or do you write them from scratch every
single time?</q> I started drafting a reply, which broke Mastodon’s character
limit. So, now it’s a blog post.</p>
<p>Anyhow, the structure of a readme often depends on the project, but there are
some common points.</p>
<ol>
<li>
<p>At the top of the readme, describe the purpose of the project. Be stupidly simple. State the obvious.</p>
</li>
<li>
<p>If the readme is for a website, link to the live website. It's surprising how often people miss this part.</p>
</li>
<li>
<p>If the readme is for a library, document the API. Nothing complicated, just a bullet-list with some code examples. Typescript definitions (<i>typedefs</i>) don't count. And while code should be self-documenting, it doesn't need to be the <em>only</em> form of documentation.</p>
</li>
<li>
<p>It's often helpful to link to related projects. You give those projects the boost they need, and your users can make an informed decision about your project.</p>
</li>
<li>
<p>Maintenance info: Is this just a personal project, or are you looking for actively looking for pull requests? Can people expect a quick response to their issues, comments, and pull requests? We're all busy, so there's no judgement here.</p>
</li>
<li>
<p>For legal reasons, I <em>always</em> include a short note mentioning the license.</p>
</li>
</ol>
<p>That’s my two cents. I also wrote
<a href="http://binyam.in/p/2021-08-11/">another shorter note about this topic</a>. So
that’s like, 3 cents. Which is very cheap, in case you wanted to
<a href="https://www.buymeacoffee.com/Binyamin">buy me a coffee</a>.</p>]]>
    </content>
    <id>https://binyam.in/p/2023-03-16</id>
    <link href="https://binyam.in/p/2023-03-16" rel="alternate"/>
    <published>2023-03-16T23:15:55.787Z</published>
    <title>What information do you include in the README of a web project?</title>
    <updated>2023-03-16T23:15:55.787Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>I found this quote back in September.</p>
<figure><blockquote>
<p>CSS is a programming language. As unintuitive as it might feel to you at
times, it’s not just these random things that happen. It’s built using very
specific rules. The problem is that most people never learn those rules.</p>
<p>We start learning CSS by learning the syntax, which is super simple. That
tricks us into thinking that it’s a simple language.</p>
<p>Don’t let the simple syntax trick you. Dive into it and learn how it works.</p>
</blockquote><figcaption><p><a href="https://www.kevinpowell.co">Kevin Powell</a>, Software Engineer &amp; CSS Educator, on
<cite></p><p><a href="https://twitter.com/KevinJPowell/status/1231979371386277888">twitter</a></p></cite></figcaption></figure>]]>
    </content>
    <id>https://binyam.in/p/2022-12-23</id>
    <link href="https://binyam.in/p/2022-12-23" rel="alternate"/>
    <published>2022-12-23T00:18:36.790Z</published>
    <title>The Seductive Simplicity of CSS</title>
    <updated>2022-12-23T00:18:36.790Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>I’ve been paying more attention to my website recently. I’ve been asking why it
exists, what I want it to look like, and other such questions.</p>
<p>Anyhow, as I rewrite my CSS, I’ve begun to realize how poorly I use it as a
language. My process for writing it consists mostly of trial-and-error, without
any idea of what I’m doing. That makes it hard to rewrite the code, since
there’s no organization or logic.</p>
<!-- There are many methods for writing and structuring CSS. There are linters to keep you in check, and style-guides to give you advice. And that's great &mdash; it's important to be able to find a block of CSS when you need to change it. -->
<h2 id="an-analogy">An Analogy</h2>
<p>I guess my point is that <b>writing CSS is kinda like typing on a keyboard</b>.<sup><a href="#user-content-fn-css-kbd" id="user-content-fnref-css-kbd" data-footnote-ref aria-describedby="footnote-label">1</a></sup>
Some typists don’t have the layout memorized. This group looks down at the
keyboard when typing, then up at the screen to check for accuracy, and then down
again. Other typists know the layout perfectly well, and focus their eyes on the
screen at all times.</p>
<p>In the same fashion, some developers try CSS rules until they get what they
want. The conversation goes something like this: <q>Let’s try <code>float: left</code>.
Nope. How about flexbox? Ah, there we go. But it’s not wrapping
(<em>sigh</em>).</q></p>
<p>Other developers know <em>why</em> each rule does what it does. They don’t need
to see the browser as often. There’s no “guess and check”. This second group
transcends methodologies like <a href="http://getbem.com">BEM</a>, and opinionated
questions like “how to order your rules”.</p>
<h2 id="an-ideal">An Ideal</h2>
<p>When you stop <i>pushing divs across the screen</i>, you start making a website.
I want to stop pushing divs.
<a href="https://ia.net/topics/on-apps-and-coffee">Websites are coffee makers</a>, and I
want to brew some coffee. Currently, though, I don’t <em>understand</em> CSS. I
just <em>write</em> it.</p>
<section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Footnotes</h2>
<ol>
<li id="user-content-fn-css-kbd">
<p>Not literally. I mean, I suppose you <em>are</em> typing on a
keyboard. Unless your name is Josh Comeau, and
<a href="https://www.joshwcomeau.com/blog/hands-free-coding/">you can code without using your hands</a>.
But, I digress. <a href="#user-content-fnref-css-kbd" data-footnote-backref="" aria-label="Back to reference 1" class="data-footnote-backref">↩</a></p>
</li>
</ol>
</section>]]>
    </content>
    <id>https://binyam.in/p/writing-css-with-purpose</id>
    <link href="https://binyam.in/p/writing-css-with-purpose" rel="alternate"/>
    <published>2022-01-20T19:00:58.453Z</published>
    <title>Writing CSS with Purpose</title>
    <updated>2022-01-20T19:00:58.453Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>People have come to expect a repository’s source code to guide them through the
contribution process. That job belongs to documentation and developer guides.</p>
<p>Comments are for the people writing the code, not necessarily the peanut
gallery. If a readme was meant as a sales pitch, it would be a website or a blog
post.</p>]]>
    </content>
    <id>https://binyam.in/p/2021-08-12</id>
    <link href="https://binyam.in/p/2021-08-12" rel="alternate"/>
    <published>2021-08-12T01:22:24.614Z</published>
    <title>Is GitHub's UI too friendly?</title>
    <updated>2021-08-12T01:22:24.614Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>Sadness. It surrounds our thoughts and emotions. We want to the believe this
emotion doesn’t exist, let alone affect us. But it’s always there. It watches
from the rafters, and it pulls us elsewhere – not exactly down, and not upwards
either. Sadness is a cat, and we are mice. And happiness is the mousetrap.</p>
<p>Happiness is the delusion of perfection. What we truly seek is balance. Balance
keeps your ice cream cone from falling apart again. It cannot remove the scrape
from your knee, but it can give you a bandage. A kiss goodnight will not scare
away any monsters, and still your bed will become safe for sleeping. You will
have learned nothing, because you have plenty of wisdom already.</p>
<p>Let yourself grow taller. Plants need water and sunlight, but you are not a
plant. Only fools set limits; the wise use guidelines. Run down the trail, even
as you stay on the path. When the road splits, go left. Or right, it makes no
difference. Momentum is a precious thing, and choices are all too common.</p>]]>
    </content>
    <id>https://binyam.in/p/2021-06-13</id>
    <link href="https://binyam.in/p/2021-06-13" rel="alternate"/>
    <published>2021-06-13T20:45:25.000Z</published>
    <title>On Sadness and Happiness</title>
    <updated>2021-06-13T20:45:25.000Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>I was looking at some posts from my RSS feed, and a piece by
<a href="https://ethanmarcotte.com/">Ethan Marcotte</a> caught my eye. It helps to know
that people still value kindness.</p>
<figure><blockquote>
<p>Is there a piece of professional or life advice you’ve gotten that has always
stuck with you? What is it? My grandmother once told me, “You should offer
praise in public, and offer gentle criticism in private.” She said a lot that
shaped the way I approach the world, but I think about that particular
suggestion a lot.</p>
</blockquote><figcaption><p>Ethan Marcotte, in
<cite><a href="https://ethanmarcotte.com/wrote/bookiversary/#is-there-a-piece-of-professional-or-life-advice-youve-gotten-that-has-always-stuck-with-you-what-is-it">Bookiversary</a></cite></p></figcaption></figure>]]>
    </content>
    <id>https://binyam.in/p/2021-06-11</id>
    <link href="https://binyam.in/p/2021-06-11" rel="alternate"/>
    <published>2021-06-11T20:43:27.394Z</published>
    <title>Advice on giving feedback</title>
    <updated>2021-06-11T20:43:27.394Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>I saved 65 KB on this site. Basically, I removed two web-fonts and cut out some
CSS. Overall, I went from 93.8 KB to 28.8 KB.</p>
<p>I rewrote my styles using vanilla CSS. Originally, I was using a
<a href="https://sass-lang.com/">SCSS</a> because of its nesting capability. Another
benefit of SCSS is that you can split your styles among multiple files. By
default, CSS doesn’t perform well in that respect<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup>. An advantage of using
CSS, was that it forced me to write my styles more succinctly. By limiting
myself to one file, I gave myself a practical reason to keep the file size to a
minimum.</p>
<p>I also started loading fewer web-fonts. I removed the body and display
web-fonts, opting for local fonts instead. I was using Roboto (sans-serif) for
the body text, and Lora (serif) for the headings. I switched them both to a
single, local-only, “catch-all” font stack. I can hardly tell the difference.</p>
<p>Otherwise, I made minimal changes to the website’s visual design. In the process
of rewriting the CSS, I made some stylistic decisions. For example, I changed
the theme of my code blocks from “Nord” (a dark theme) to “GitHub Light”. I also
removed the CSS reset I was using, which was
<a href="https://necolas.github.io/normalize.css/">normalize.css by Nicolas Gallagher</a>.</p>
<figure><figcaption><p>Size Comparison</p></figcaption><table>
	<thead>
		<tr>
			<th></th>
			<th>Before</th>
			<th>After</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<th scope="row">Roboto font</th>
			<td>15.4 KB</td>
			<td>0</td>
		</tr>
		<tr>
			<th scope="row">Lora font</th>
			<td>34.5 KB</td>
			<td>0</td>
		</tr>
		<tr>
			<th scope="row">Google Fonts CSS *</th>
			<td>11.4 KB</td>
			<td>2.4 KB</td>
		</tr>
		<tr>
			<th scope="row">Normalize & code-block theme *</th>
			<td>4.2 KB</td>
			<td>854 B</td>
		</tr>
		<tr>
			<th scope="row">Sitewide CSS *</th>
			<td>5.4 KB</td>
			<td>3.4 KB</td>
		</tr>
		<tr>
			<th scope="row">Print CSS</th>
			<td>801 B</td>
			<td>748 B</td>
		</tr>
	</tbody>
</table><p>* Uncompressed size</p></figure>
<p>Oh, and the best part is… my site is now only 100 ms faster. 326% smaller,
8.3% faster. Go figure. 🤷‍♂️</p>
<section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Footnotes</h2>
<ol>
<li id="user-content-fn-1">
<p>Think about it. Every time you request a CSS file, whether using a
<code>&lt;link/&gt;</code> tag or <code>@include</code> syntax, you make a network request. As every
network request has a cost, it’s much more practical to combine your CSS
into one file. <a href="#user-content-fnref-1" data-footnote-backref="" aria-label="Back to reference 1" class="data-footnote-backref">↩</a></p>
</li>
</ol>
</section>]]>
    </content>
    <id>https://binyam.in/p/2021-03-18</id>
    <link href="https://binyam.in/p/2021-03-18" rel="alternate"/>
    <published>2021-03-18T00:53:47.797Z</published>
    <title>I shaved 65 kilobytes off my site</title>
    <updated>2021-03-18T00:53:47.797Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>I read
<a href="https://kevq.uk/why-having-a-full-post-rss-feed-is-a-good-idea/">a post by Kev Quirk</a>
championing full-post RSS feeds.</p>
<p>I’m trying to think of ways to encourage people who use my RSS feed (if they
exist 😉) to actually read the articles on my website.</p>
<p>Why? I work hard on my website.</p>
<ul>
<li>I try to be accessible at all times</li>
<li>I aim for the optimal reading experience</li>
<li>I design for aesthetics as well as simplicity</li>
</ul>
<p>Mainly, though, my website represents <em>me</em>. It’s the only coding project I’ve
worked on steadily for the past three years. It’s been painstakingly redesigned
multiple times, and I try to put flair and charm into each iteration. I care
deeply about my website.</p>
<p>If you have any suggestions, please <a href="/contact">let me know</a>.</p>]]>
    </content>
    <id>https://binyam.in/p/2021-01-11</id>
    <link href="https://binyam.in/p/2021-01-11" rel="alternate"/>
    <published>2021-01-11T15:17:13.385Z</published>
    <title>Doubting full-post RSS feeds</title>
    <updated>2021-01-11T15:17:13.385Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>At the beginning of 2020, after seeing a Goodreads challenge, I decided to read
twelve books that year. And I did read some wonderful books and novels. In
<a href="https://www.goodreads.com/book/show/37903770-norse-mythology"><em>Norse Mythology</em></a>,
Neil Gaiman paints a pretty picture of the Norse pantheon.
<a href="https://www.goodreads.com/book/show/31868169-letters-to-a-young-writer"><em>Letters to a Young Writer</em></a>,
by Colum McCann, advises young writers on how to hone their craft, and itself
exhibits excellent writing.</p>
<h2 id="the-problem">The Problem</h2>
<p>While I loved what I read, I only completed seven out of the twelve I had
planned to read. Initially, I was disappointed that I didn’t meet my goal.
Reading one book each month should not have been hard for me to do. Why couldn’t
I have just <em>read more</em>?</p>
<p>Looking back, I find that I didn’t want to rush through any books. In order to
read a 300-page book in one month, I would need to do at least ten pages per
day. That’s great for fiction or light-reading. But some of the books I had
lined-up were full of information which needed processing. My system was faulty.</p>
<h2 id="a-new-goal">A New Goal</h2>
<p>If I’m going to up my reading game in 2021, I need to devise a different
challenge. I could separate my books into light-reading and heavy-reading. Or
maybe my goal was fine, and I need to widen my selection of books.</p>
<p>As I write this, I realize that the issue is about my <em>choice</em> of books. You
see, there are a couple things I’d like to accomplish by reading. I want to take
an emotional journey through a fabricated world. I’d also like to learn more
about certain concepts and ideas. To me, this distinction is similar to that of
fiction versus non-fiction.</p>
<p><strong>Here’s my new goal</strong>: I’d like to read ten books this year. Of those ten, four
must be novels or light-reading. The remaining six are be up to me.</p>
<h2 id="parting-thoughts">Parting Thoughts</h2>
<p>Honestly, though, every book can be a novel. Every book should be a journey,
broken into both logical and emotionally-provoking sections. How else did Lin
Manuel-Miranda transform a scholarly work into the acclaimed broadway musical,
<em>Hamilton</em>? You don’t need to be a writer to tell stories, but you should tell a
story when you write.</p>
<hr>
<h2 id="full-list">Full List</h2>
<p>Here’s my full book list from 2020.</p>
<ol>
<li><em>Norse Mythology</em>, by Neil Gaiman</li>
<li><em>The Voyage of the Dawn Treader</em> (Chronicles of Narnia #5), by C. S. Lewis</li>
<li><em>Writer’s Digest Guide to Magazine Article Writing</em>, by Kerrie L. Flanagan</li>
<li><em>Letters to a Young Writer</em>, by Colum McCann</li>
<li><em>Tuesdays with Morrie</em>, by Mitch Albom</li>
<li><em>Mister Monday</em> (The Keys to the Kingdom #1), by Garth Nix</li>
<li><em>Grim Tuesday</em> (The Keys to the Kingdom #2), by Garth Nix</li>
</ol>
<p>I ended the year in the middle of <em>A Universe Made for Two</em>, by Jack M. Daniel.</p>]]>
    </content>
    <id>https://binyam.in/p/my-reading-goals-in-2020</id>
    <link href="https://binyam.in/p/my-reading-goals-in-2020" rel="alternate"/>
    <published>2021-01-04T20:38:53.122Z</published>
    <title>My Reading Goals in 2020</title>
    <updated>2021-01-04T20:38:53.122Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p><q cite="https://www.w3.org/Provider/Style/URI.html">URIs don’t change: people
change them.</q> That’s what
<a href="https://en.wikipedia.org/wiki/Tim_Berners-Lee">Tim Berners-Lee</a> says, either
way. I was reading his article
<a href="https://www.w3.org/Provider/Style/URI.html">“Cool URIs don’t change”</a>, and I
started thinking about my own website. I recently implemented
<a href="/c/micro">a micro blog</a>, and it’s possible that I will want more kinds of posts
in the future.</p>
<p>That’s the answer, I realized! They’re all <em>posts</em>, each with a different
<em>category</em>. I decided to construct these categories using the Indieweb’s concept
of a <a href="https://indieweb.org/posts#Types_of_Posts"><strong>post type</strong></a>. I just need a
blog and a micro blog (indieweb: articles and notes), and I should have room for
other posts like photos and book reviews.</p>
<p>So, I changed my <abbr title="Uniform Resource Locator">URL</abbr> structure.
Static pages, such as contact and now, stay the same. If it’s a post, it’ll be
under <code>/p/{title}/</code>. Lastly, each post had a category page like <code>/blog/</code>. Under
this new system, that’ll be <code>/c/{category}/</code>.</p>
<p>Okay, that’s a wrap on this article. Oh, one more thing. I set up redirects for
my old posts. That’s all. Thanks for reading!</p>]]>
    </content>
    <id>https://binyam.in/p/2020-12-29</id>
    <link href="https://binyam.in/p/2020-12-29" rel="alternate"/>
    <published>2020-12-29T22:11:45.853Z</published>
    <title>Reorganizing my website</title>
    <updated>2020-12-29T22:11:45.853Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>“Silence is Golden”, they say. They’re right, of course. Silence is the key to
every problem, as well as to every proposed solution. Arguing won’t solve
problems; not directly, anyhow. So what will? Listen, you say. And you yell, a
long, painful moan. I sit, and you scream. I listen while you lament. It’s a
powerful dynamic, this. I learn your hardships, and you- well, I don’t know what
you do, but it’s dramatic. You shout, and I sympathize. You accuse, and I admit.
Is it my turn yet?</p>
<p>Finally, you come to the end of your conversation. A question burns in my belly,
though I dare not ask it. You leave, and take with you a bundle of anger. I
leave too, adding yours to my collection. May I talk now? No, not yet. You see,
to talk I need a listener. My door is open; you may vent any time you please.
Perhaps, one day, you will open yours.</p>]]>
    </content>
    <id>https://binyam.in/p/2020-12-15</id>
    <link href="https://binyam.in/p/2020-12-15" rel="alternate"/>
    <published>2020-12-15T02:05:08.000Z</published>
    <title>Your Turn to Yell</title>
    <updated>2020-12-15T02:05:08.000Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>Blogs can quickly become disorganized. You might want to link to a page on your
website which only lists posts about CSS. With a bit of javascript, you can use
<code>/blog?tag=css</code> to filter your posts.</p>
<p>For the following method to work, each post item should have a
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*">data attribute</a>
of <code>data-tags="[tag1,tag2]"&gt;</code>. On a related note, the method assumes a basic
knowledge of HTML. Feel free to glance at
<a href="https://www.w3schools.com/html/">W3Schools</a> or
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML">MDN</a>.</p>
<p>First, we need to find our posts. Use the <code>document.querySelectorAll</code>
method<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup>. The method takes one parameter: A selector string formatted like a
css selector. Now, we need to get the tag in the url. The global
<code>location.search</code> variable provides us with the query parameters at the end of
the url. This will give us a string, such as <code>?topic=css</code>, which we can
manipulate to find the tag.</p>
<p>Find which posts <em>don’t</em> have the tag. For each post, check if the tags in the
<code>data-tags</code> attribute include the one we found in the url. (Hint: use
<code>Array.filter</code>) Then, hide the filtered posts. HTML has a handy <code>hidden</code>
attribute for situations like this. Set the hidden attribute of each filtered
post to <code>true</code>.</p>
<p>You can now filter your blog posts by tag. Here’s the full snippet.</p>
<pre class="astro-code vitesse-light" style="background-color:#ffffff;color:#393a34; overflow-x: auto;" tabindex="0" data-language="html"><code><span class="line"><span style="color:#999999">&lt;</span><span style="color:#1E754F">ul</span><span style="color:#999999">&gt;</span></span>
<span class="line"><span style="color:#999999">	&lt;</span><span style="color:#1E754F">li</span><span style="color:#B07D48"> class</span><span style="color:#999999">=</span><span style="color:#B5695977">"</span><span style="color:#B56959">post</span><span style="color:#B5695977">"</span><span style="color:#999999">&gt;</span></span>
<span class="line"><span style="color:#A0ADA0">		&lt;!-- contents --&gt;</span></span>
<span class="line"><span style="color:#999999">	&lt;/</span><span style="color:#1E754F">li</span><span style="color:#999999">&gt;</span></span>
<span class="line"><span style="color:#A0ADA0">	&lt;!-- more --&gt;</span></span>
<span class="line"><span style="color:#999999">&lt;/</span><span style="color:#1E754F">ul</span><span style="color:#999999">&gt;</span></span></code></pre>
<pre class="astro-code vitesse-light" style="background-color:#ffffff;color:#393a34; overflow-x: auto;" tabindex="0" data-language="js"><code><span class="line"><span style="color:#A0ADA0">// Select all posts</span></span>
<span class="line"><span style="color:#AB5959">const</span><span style="color:#B07D48"> posts</span><span style="color:#999999"> =</span><span style="color:#999999"> [...</span><span style="color:#B07D48">document</span><span style="color:#999999">.</span><span style="color:#59873A">querySelectorAll</span><span style="color:#999999">(</span><span style="color:#B5695977">'</span><span style="color:#B56959">.post</span><span style="color:#B5695977">'</span><span style="color:#999999">)];</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A0ADA0">// Get the tag in the url</span></span>
<span class="line"><span style="color:#AB5959">const</span><span style="color:#B07D48"> tag</span><span style="color:#999999"> =</span><span style="color:#B07D48"> location</span><span style="color:#999999">.</span><span style="color:#B07D48">search</span><span style="color:#999999">.</span><span style="color:#59873A">slice</span><span style="color:#999999">(</span><span style="color:#B07D48">location</span><span style="color:#999999">.</span><span style="color:#B07D48">search</span><span style="color:#999999">.</span><span style="color:#59873A">indexOf</span><span style="color:#999999">(</span><span style="color:#B5695977">'</span><span style="color:#B56959">=</span><span style="color:#B5695977">'</span><span style="color:#999999">)</span><span style="color:#AB5959"> +</span><span style="color:#2F798A"> 1</span><span style="color:#999999">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#1E754F">if</span><span style="color:#999999"> (</span><span style="color:#B07D48">tag</span><span style="color:#999999">)</span><span style="color:#999999"> {</span></span>
<span class="line"><span style="color:#A0ADA0">	// Find which posts don’t have the tag</span></span>
<span class="line"><span style="color:#AB5959">	let</span><span style="color:#B07D48"> postsNoTag</span><span style="color:#999999"> =</span><span style="color:#B07D48"> posts</span><span style="color:#999999">.</span><span style="color:#59873A">filter</span><span style="color:#999999">(</span><span style="color:#B07D48">l</span><span style="color:#999999"> =&gt;</span><span style="color:#999999"> {</span></span>
<span class="line"><span style="color:#1E754F">		return</span><span style="color:#B07D48"> JSON</span><span style="color:#999999">.</span><span style="color:#59873A">parse</span><span style="color:#999999">(</span><span style="color:#B07D48">l</span><span style="color:#999999">.</span><span style="color:#B07D48">dataset</span><span style="color:#999999">.</span><span style="color:#B07D48">tags</span><span style="color:#999999">).</span><span style="color:#59873A">includes</span><span style="color:#999999">(</span><span style="color:#B07D48">tag</span><span style="color:#999999">)</span><span style="color:#AB5959"> ===</span><span style="color:#1E754F"> false</span><span style="color:#999999">;</span></span>
<span class="line"><span style="color:#999999">	});</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A0ADA0">	// Hide all posts which don’t have the tag</span></span>
<span class="line"><span style="color:#B07D48">	postsNoTag</span><span style="color:#999999">.</span><span style="color:#59873A">forEach</span><span style="color:#999999">(</span><span style="color:#B07D48">p</span><span style="color:#999999"> =&gt;</span><span style="color:#999999"> {</span></span>
<span class="line"><span style="color:#B07D48">		p</span><span style="color:#999999">.</span><span style="color:#59873A">setAttribute</span><span style="color:#999999">(</span><span style="color:#B5695977">'</span><span style="color:#B56959">hidden</span><span style="color:#B5695977">'</span><span style="color:#999999">,</span><span style="color:#1E754F"> true</span><span style="color:#999999">);</span></span>
<span class="line"><span style="color:#999999">	});</span></span>
<span class="line"><span style="color:#999999">}</span></span></code></pre>
<section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Footnotes</h2>
<ol>
<li id="user-content-fn-1">
<p>For more details, see
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll">this page on MDN</a>. <a href="#user-content-fnref-1" data-footnote-backref="" aria-label="Back to reference 1" class="data-footnote-backref">↩</a></p>
</li>
</ol>
</section>]]>
    </content>
    <id>https://binyam.in/p/filter-posts-by-tag</id>
    <link href="https://binyam.in/p/filter-posts-by-tag" rel="alternate"/>
    <published>2020-06-10T16:00:00.000Z</published>
    <title>Filter Posts by Tag</title>
    <updated>2021-05-20T17:21:42.000Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>On the front page of a blog, we often list the title of every post on the site.
<a href="https://jekyllrb.com">Jekyll</a> will automatically list all pages within the
<code>_post</code> directory under one collection. <a href="https://11ty.dev">Eleventy</a>, however,
creates collections based on the tags. In other words, the only way to tell
Eleventy that your page is a blog post is by adding an extra tag. You may not
want to add the same tag for every post, especially if you already categorize
your posts.</p>
<p>One <del>workaround</del> <em>fully documented feature</em> is to create a custom collection.
In <code>.eleventy.js</code>, use the <code>addCollection</code> method to define a new collection.
You can call it <em>posts</em>, if you want to (you can also call it <em>ice_cream</em>). Use
<a href="https://github.com/isaacs/node-glob">glob syntax</a> to get only the pages inside
your post folder. You can now find all your blog posts with the
<code>collections.posts</code> variable.</p>
<p>Here’s the code for your <code>.eleventy.js</code> file.</p>
<pre class="astro-code vitesse-light" style="background-color:#ffffff;color:#393a34; overflow-x: auto;" tabindex="0" data-language="js"><code><span class="line"><span style="color:#998418">module</span><span style="color:#999999">.</span><span style="color:#998418">exports</span><span style="color:#999999"> =</span><span style="color:#AB5959"> function</span><span style="color:#999999">(</span><span style="color:#B07D48">eleventyConfig</span><span style="color:#999999">)</span><span style="color:#999999"> {</span></span>
<span class="line"><span style="color:#B07D48">	eleventyConfig</span><span style="color:#999999">.</span><span style="color:#59873A">addCollection</span><span style="color:#999999">(</span><span style="color:#B5695977">'</span><span style="color:#B56959">posts</span><span style="color:#B5695977">'</span><span style="color:#999999">,</span><span style="color:#AB5959"> function</span><span style="color:#999999">(</span><span style="color:#B07D48">collection</span><span style="color:#999999">)</span><span style="color:#999999"> {</span></span>
<span class="line"><span style="color:#1E754F">		return</span><span style="color:#B07D48"> collection</span><span style="color:#999999">.</span><span style="color:#59873A">getFilteredByGlob</span><span style="color:#999999">(</span><span style="color:#B5695977">'</span><span style="color:#B56959">posts/**/*.md</span><span style="color:#B5695977">'</span><span style="color:#999999">);</span></span>
<span class="line"><span style="color:#999999">	});</span></span>
<span class="line"><span style="color:#A0ADA0">	// ...</span></span>
<span class="line"><span style="color:#999999">};</span></span></code></pre>]]>
    </content>
    <id>https://binyam.in/p/list-all-posts-using-11ty</id>
    <link href="https://binyam.in/p/list-all-posts-using-11ty" rel="alternate"/>
    <published>2020-05-04T16:00:00.000Z</published>
    <title>List all Posts using 11ty</title>
    <updated>2020-05-04T16:00:00.000Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>Intricate worlds ensnare the mind. For this reason, I enjoy reading fantasy and
science-fiction books. There are so many good novels, and endless amounts of
excellent short-fiction. To create a list of my favorite stories is impossible —
I have so many! What follows, then, is a rough list of a couple books which I
adore.</p>
<h2 id="harry-potter-and-the-order-of-the-phoenix">Harry Potter and the Order of the Phoenix</h2>
<p><em>By J. K. Rowling (Harry Potter, book 5)</em></p>
<p><a href="https://www.barnesandnoble.com/w/harry-potter-and-the-order-of-the-phoenix-j-k-rowling/1100041270">Barnes &amp; Noble</a></p>
<p>The fifth book of the Harry Potter series has always stuck with me, maybe
because it represents coming-of-age. Harry Potter becomes a man as he defies the
Ministry’s control of his school. But maybe I love it because of the world in
which J. K. Rowling places us, and the magic she brings to our lives by doing
so.</p>
<h2 id="the-voyage-of-the-dawn-treader">The Voyage of the Dawn Treader</h2>
<p><em>By C. S. Lewis (The Chronicles of Narnia, book 5)</em></p>
<p><a href="https://www.barnesandnoble.com/w/voyage-of-the-dawn-treader-c-s-lewis/1100550844?ean=9780061969065">Barnes &amp; Noble</a></p>
<p>This story tells of wonderful, adventurous myth. The book is an expedition into
our minds, probing the depths of our imagination.<em>The Voyage of the Dawn
Treader</em>is a standard of children’s literature.</p>
<h2 id="norse-mythology">Norse Mythology</h2>
<p><em>By Neil Gaiman</em></p>
<p><a href="https://www.barnesandnoble.com/w/norse-mythology-neil-gaiman/1124023596">Barnes &amp; Noble</a></p>
<p>Some would call this book a record of history. The stories, however, continue to
enthrall and entrance as no history textbook ever has. Gaiman departs from
Marvel’s floodlit depiction of Thor the Mighty and gives insight into the
complex mind of Loki the Trickster. He paints the Norse pantheon with a
signature, resplendent touch.</p>
<h2 id="the-fellowship-of-the-ring">The Fellowship of the Ring</h2>
<p><em>By J. R. R. Tolkien (Lord of the Rings, Part One)</em></p>
<p><a href="https://www.barnesandnoble.com/w/fellowship-of-the-ring-j-r-r-tolkien/1100013647">Barnes &amp; Noble</a></p>
<p>J. R. R. Tolkien was an Oxford professor, and the writing style reflects his
stature. The world is magnificent, and the plot is riveting. I particularly
connect with the main character, Frodo Baggins. Frodo is timid yet persistant,
which I relate to.</p>
<h2 id="the-martian-chronicles">The Martian Chronicles</h2>
<p><em>By Ray Bradbury</em></p>
<p><a href="https://www.barnesandnoble.com/w/martian-chronicles-ray-bradbury/1100197062?ean=9780062079930">Barnes &amp; Noble</a></p>
<p>This collection of science-fiction stories covers Earth’s colonization of Mars,
both from the explorers’ perspectives as well as from the natives’ viewpoint. As
well as entertaining our imagination, Ray Bradbury warns of a dark future; one
which is in our hands.</p>
<h2 id="a-study-in-scarlet">A Study in Scarlet</h2>
<p><em>By Sir Arthur Conan Doyle (A Sherlock Holmes novel)</em></p>
<p><a href="https://www.barnesandnoble.com/w/study-in-scarlet-arthur-conan-doyle/1100163548?ean=9780140439083">Barnes &amp; Noble</a></p>
<p>Soon after Jack the Ripper tore through London, Sir Arthur Conan Doyle
introduced a detective who saw through any crime. Sherlock Holmes meets his
legendary partner, John Watson, and the rest is history. As we become intimate
with Holmes, we observe his many strengths and inevitable weaknesses. Sherlock
Holmes’ debut story is an essential piece for any bookcase.</p>
<h2 id="the-letter-for-the-king">The Letter for the King</h2>
<p><em>By Tonke Dragt</em></p>
<p><a href="https://www.barnesandnoble.com/w/the-letter-for-the-king-tonke-dragt/1117057885?ean=9781782690818">Barnes &amp; Noble</a></p>
<p>Tonke Dragt published this story in the Netherlands in 1962, but it was over
fifty years before it was introduced to the English-speaking world.
Sixteen-year-old Tiuri must trust no one as he ventures forth on his simple
mission. As he fends of bandits on the back of each page, he emanates
self-worth.</p>
<hr>
<p>These are just a few of my favorites. Frank Herbert, Roald Dahl, and many others
have also left behind timeless works. For more wonderful titles, check out
<a href="https://www.pbs.org/the-great-american-read/books/">The Great American Read</a> by
PBS, or poke around on <a href="https://goodreads.com/">Goodreads</a>.</p>]]>
    </content>
    <id>https://binyam.in/p/my-top-reading-picks</id>
    <link href="https://binyam.in/p/my-top-reading-picks" rel="alternate"/>
    <published>2020-03-23T16:00:00.000Z</published>
    <title>My top reading picks</title>
    <updated>2020-03-23T16:00:00.000Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>Here, I subtly introduce you to the topic at hand, and grab your attention. I
may use fantastic words and extravagant linguistics, or I can just be really
boring and stuff. That’s called an <strong>introduction</strong>. Use it.</p>
<p>Now, I start to get into the <em>nitty-gritty</em> of the article. I may include some
cool things like <code>{% liquid:tags %}</code> or inline code.</p>
<pre class="astro-code vitesse-light" style="background-color:#ffffff;color:#393a34; overflow-x: auto;" tabindex="0" data-language="js"><code><span class="line"><span style="color:#B07D48">document</span><span style="color:#999999">.</span><span style="color:#59873A">before</span><span style="color:#999999">(</span><span style="color:#B5695977">'</span><span style="color:#B56959">codeBlock</span><span style="color:#B5695977">'</span><span style="color:#999999">,</span><span style="color:#999999"> ()</span><span style="color:#999999"> =&gt;</span><span style="color:#999999"> {</span></span>
<span class="line"><span style="color:#1E754F">  do</span><span style="color:#999999">(</span><span style="color:#B5695977">"</span><span style="color:#B56959">explain with words</span><span style="color:#B5695977">"</span><span style="color:#999999">);</span></span>
<span class="line"><span style="color:#999999">})</span></span></code></pre>
<p>Now, I write another paragraph. Write at least two <strong>body</strong> paragraphs, with at
least three sentences each. Use proper grammar, <del>ppl</del> people!</p>
<p>Lastly, I leave you with a thought which will remind you of what I’ve written.
It’s called a <strong>conclusion</strong>, and it’s like a party favor or gift. It leaves the
reader with a good impression. Think of it as a nice way of saying, <em>goodbye</em>.</p>]]>
    </content>
    <id>https://binyam.in/p/2020-03-12</id>
    <link href="https://binyam.in/p/2020-03-12" rel="alternate"/>
    <published>2020-03-12T12:00:00.000Z</published>
    <title>[A clever phrase]</title>
    <updated>2020-03-12T12:00:00.000Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p><strong>Note:</strong> This article is a summary of
<a href="https://peterthaleikis.com/business-idea-validation/">https://peterthaleikis.com/business-idea-validation/</a></p>
<p>Eureka! You have a business idea. What should you do first? No, It’s not the
development phase. It isn’t the design or the marketing stage. The process
begins with validating your idea.</p>
<p>People like to jump at whims, but starting with research is helpful for many
reasons. Most likely, you have no money set aside to allocate for the idea. Even
though you’re motivated at the moment, you will get discouraged after a while.
You’ll discover competition, or find the marketing stressful and overwhelming.
Whatever the reason, plowing through the initial stages will give you powerful
insights for the future.</p>
<p>To validate your idea, conduct some research. Gather a list of relevant phrases,
words, and topics (keywords and keyphrases). Throw them at a bunch of popular
websites, such as Google search, YouTube, Facebook, and Quora. (The article that
I’m summarizing has a list of fifteen such sites). But don’t just research your
idea, also look at your competitors. Use online tools to check their social
media presence and evaluate their backlinks. Lastly, talk to friends about your
idea. Get real feedback from real people. Mention it on Twitter, and see how
people react. <em>A picture paints a thousand words, but people paint pictures.</em></p>]]>
    </content>
    <id>https://binyam.in/p/notes-on-startup-ideas</id>
    <link href="https://binyam.in/p/notes-on-startup-ideas" rel="alternate"/>
    <published>2019-12-17T01:37:30.434Z</published>
    <title>Notes on Startup Ideas</title>
    <updated>2019-12-17T01:37:30.434Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>I’ve always tried to avoid Webpack. I would tell myself it was either too
complicated or unnecessary. After all, it’s not the only tool of its kind on the
market. Yet recently I’ve come to terms with Webpack. Once you know how to use
it, it can be a very effective tool.</p>
<p>Webpack’s main usage is bundling JavaScript. In node.js, we generally use
<code>require</code> or <code>import</code> to include an external resource in our JavaScript file.
Yet browsers don’t understand <code>require</code>. You can either include the resource in
the head of your HTML or make an HTTP request to a URL. With Webpack, though,
you can bundle your in-browser code. Webpack will combine all the files that you
imported using require and stick them in your file. Bundling can also take care
of features such as ES6 notation which may not be compatible across all
browsers. This requires the babel plugin.</p>
<p>Another use-case is minifying CSS and/or JavaScript. Minification strips all
white-space from a file. It’s a very effective way of decreasing file size, thus
speeding up load time. Minifying JavaScript requires no plugins, yet minifying
CSS does. There are also plugins which increase the browser-compatibility of
your CSS.</p>
<p>You can preprocess SCSS. There are other ways, such as gulp, node-sass, and even
a VS Code extension. But once you’re using Webpack this is a pretty useful
feature. This requires a Webpack loader.</p>
<p>You can compile JSX for ReactJS. This is can be easier to set up in some
situations, especially in a complex environment such as an electron app. There’s
a good tutorial on compiling JSX with Webpack
<a href="https://www.valentinog.com/blog/babel/">here</a>. Note that this requires a plugin
as well.</p>
<p>You can compile Typescript with it. You <em>can</em>
<a href="https://code.visualstudio.com/Docs/languages/typescript">compile Typescript within VS Code</a>,
though Webpack may be more efficient because you can run many tasks with one
command. This requires a plugin.</p>
<p>You can run a development server with your static files. Extensions do exist to
serve that purpose, though Webpack can prove useful when running many tasks or
complicated setups. This requires an extra package.</p>
<p>I don’t know the next time you will consider using Webpack, but I hope that now
you will be more prepared.</p>]]>
    </content>
    <id>https://binyam.in/p/six-uses-for-webpack</id>
    <link href="https://binyam.in/p/six-uses-for-webpack" rel="alternate"/>
    <published>2019-11-15T11:05:00.622Z</published>
    <title>Six Uses for Webpack</title>
    <updated>2019-11-15T11:05:00.622Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>Okay, so it hasn’t actually been a year. It’s been slightly over eight months.
But I digress. Since February of 2019, I have been a moderator on a discord
community named <em>DesignCourse (Coursetro)</em>. Created by YouTuber Gary Simon, this
place serves as a forum for questions and discussions regarding all sorts of
design and development related topics. Recently, I realized that I have grown as
a mod, as a developer, and as a person, since that day in February.</p>
<p><a href="#summary"><strong>tl;dr</strong></a></p>
<p><em>All opinions expressed herein are my own</em></p>
<p>I’ve noticed that many users who ask questions are a bit clueless as to what
they would like answered. They know they have an error in their code, and they
know that’s bad. However, they don’t really understand what information to give
or where to focus their question. When someone asks a question, they are really
waving a flag for help, not asking a technical question. Obviously, this is also
what you do inadvertently when <em>you</em> ask a question. Recognizing that you are
clueless is the first step to a better “I need help” experience.</p>
<p><del>People don’t think.</del> (Yes, that’s very general.) People <em>usually</em> think. But
you and I know that it’s very easy to ask for help without actually talking
through the issue at hand. And this is very important to realize. People don’t
sift through archives to find duplicate issues, or host the complicated code
that they want help with. But that’s exactly where <em>you</em> come in. Stepping
through an obvious error, or teaching somebody the wondrous world of Codepen, is
actually helping them solve their error. Simply typing <em>“please read the rules”</em>
is not as useful. Just a thought.</p>
<p>Spammers are never wanted. I’m referring to those who advertise their service
without being asked. You’ve probably seen them on discord or youtube, posting
their website and whatnot. Sometimes, they are just being jerks. But when you
talk to them, a whole different story comes out. Sometimes, they’ve been told to
do it for marketing. Other times, they are trying to ask for help, but totally
miss the mark. Once, I found a great resource and posted it on Gitter so people
would use it, only to banned for spamming (I got back on eventually, but yeah).
Spammers often mean well.</p>
<p>It’s very rewarding to help your sibling tie their shoes. Not all of us have a
sibling or siblings of the relevant age, but we all have each other. I know that
sounds cheesy, but hear me out, okay? As a moderator, I’m responsible for
thousands of users daily. The environment must be safe, kind, and helpful. I’m
proud of what I do, because as little as it may seem, I’m helping other people.</p>
<p>Finally, help can come in unexpected methods. It’s nice to know that a senior
dev or designer is having the same issue as you, even if they can’t figure it
out either. It’s also useful when someone points you to a guide without really
answering your question. Of course, it’s better to give a complete answer, but
there’s a next-best option. You don’t need to know it to be helpful.</p>
<p>I love answering questions or giving feedback. In my opinion, it helps me grow
as a person. Additionally, I like the camaraderie that comes with being part of
a community, if only an online one. It only takes a minute to help someone else,
and with the internet you can find questions to be answered all of the time.</p>
<h2 id="summary">Summary</h2>
<ul>
<li>people don’t always know what they’re asking for</li>
<li>people don’t always think before asking questions</li>
<li>spammers usually don’t mean to spam</li>
<li>taking care of people is a healthy source of pride</li>
<li>you don’t need to answer to be helpful</li>
</ul>
<p>Come visit the <a href="https://discord.gg/a27CKAF">DesignCourse discord server</a>, and
give me feedback on this article via email. That’s all for now. Take care.</p>]]>
    </content>
    <id>https://binyam.in/p/my-year-as-a-moderator</id>
    <link href="https://binyam.in/p/my-year-as-a-moderator" rel="alternate"/>
    <published>2019-10-25T19:10:26.424Z</published>
    <title>My Year as a Moderator</title>
    <updated>2019-10-25T19:10:26.424Z</updated>
  </entry>
  <entry>
    <content type="html">
      <![CDATA[<p>Adobe XD is becoming the go-to tools for UI/UX Designers in 2019. It’s free,
modern, and extensible. XD has many features, some of which you may not be aware
of. Here are five useful tips for working within Adobe XD.</p>
<hr>
<h2 id="math">Math</h2>
<p>Adobe XD, as well as other programs such as Blender, Gimp and Inkscape, allows
math in the input fields. Let’s say that I had two circles with a width of 258px
each , and I wanted one to be half as big as the other. I could do the math
mentally, which could get complicated. Or, I could type 258/2, and XD will do
the math for me.</p>
<p><img __ASTRO_IMAGE_="{&quot;alt&quot;:&quot;Doing math in Adobe XD&quot;,&quot;src&quot;:&quot;~/assets/uploads/math-in-xd.gif&quot;,&quot;index&quot;:0}"></p>
<h2 id="assets">Assets</h2>
<p>I use these all of the time.</p>
<p>Open the assets panel by typing <code>ctrl/cmd + shift + y</code>. Then, select a object
and click on the plus sign next to the word “color”. That object’s color is now
set based on the swatch in the assets panel. You can add that exact color to
another object by selecting the object and clicking on the swatch. You can also
edit the swatch by right-clicking and selecting “Edit”.</p>
<p>PS: This works for text styles as well.</p>
<h2 id="guides">Guides</h2>
<p>XD has awesome automatic guides which can help you align things perfectly.
Sometimes, though, the auto-guides just aren’t helping. Enter, guides. Well,
manual guides. Drag from the top or left edge of an artboard to create a thin
guide manually. You can position it wherever you like, and not worry about
making XD understand where exactly you want to position your item.</p>
<h2 id="adjust-corners-separately">Adjust Corners Separately</h2>
<p>I found this awesome tip in
<a href="https://twitter.com/elainecchao/status/1123289664671100928">a tweet from Elaine Chao</a>.</p>
<figure><blockquote>
<p>#adobexd #protip Want to adjust the corners independently? Simply hold down
Alt/Opt while dragging the corner to detach it from the others.</p>
<p>@adobexd</p>
</blockquote><figcaption><p>By <a href="https://twitter.com/elainecchao/status/1123289664671100928">@elaincchao</a> on
Twitter</p></figcaption></figure>
<p>Thanks Elaine.</p>
<h2 id="shortcuts">Shortcuts</h2>
<p>Shortcuts are awesome. They speed up your workflow, and make you look really
professional 😎. You can find a comprehensive list here. Some useful shortcuts
are:</p>
<ul>
<li><code>ctr/cmd + k</code>: Create component from selection</li>
<li><code>ctrl/cmd + shift + y</code>: Toggle assets panel</li>
<li><code>alt + drag</code>: Duplicate selection</li>
</ul>]]>
    </content>
    <id>https://binyam.in/p/five-useful-tips-for-adobe-xd</id>
    <link href="https://binyam.in/p/five-useful-tips-for-adobe-xd" rel="alternate"/>
    <published>2019-06-18T16:11:04.629Z</published>
    <title>Five Useful Tips for Adobe XD</title>
    <updated>2019-06-18T16:11:04.629Z</updated>
  </entry>
</feed>
