<?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"><channel><title><![CDATA[Aleksandar Goševski]]></title><description><![CDATA[Exploring the world of web development, programming, devops, tools, design, etc.]]></description><link>https://www.aleksandargosevski.com</link><generator>RSS for Node</generator><lastBuildDate>Thu, 01 Oct 2026 17:45:50 GMT</lastBuildDate><atom:link href="https://www.aleksandargosevski.com/rss.xml" rel="self" type="application/rss+xml"/><copyright><![CDATA[2007-2025 Aleksandar Goševski]]></copyright><language><![CDATA[en]]></language><item><title><![CDATA[Build your own vim configuration from scratch]]></title><description><![CDATA[<p>If you&#39;re getting started with (Neo)vim, you&#39;ve probably noticed the many ready-to-use configurations available out there. While these pre-made setups might look tempting, I&#39;d like to share why building your own configuration is not just more rewarding, but actually better for your long-term productivity. Think of it like cooking: while takeout is convenient, learning to cook your own meals gives you control over the ingredients and helps you understand what goes into making a great dish.</p>
<h2>Why customization matters in (neo)vim</h2>
<p>At its heart, Vim is like a blank canvas - simple and powerful. The beauty of Vim lies in how you can shape it to match exactly how you think and work. When you use someone else&#39;s configuration, it&#39;s like wearing shoes that were made for someone else&#39;s feet - they might look nice, but they probably won&#39;t fit you perfectly.
Vim, at its core, is a simple editor that gains complexity through our customization. <strong>By relying on someone else&#39;s preconfigured setup, we forfeit the opportunity to explore and discover what truly works for us.</strong></p>
<p>Here&#39;s a personal example: I used to have fancy status bars at the bottom of my editor because everyone else had them. Later, I realized I rarely looked at them, so I removed them completely. Instead, I created simple keyboard shortcuts to show me important information (like the current git branch) only when I need it. This kind of &quot;aha!&quot; moment only comes when you build things yourself.</p>
<h2>Overcoming Common Excuses</h2>
<p>I often hear people say, &quot;But Vim is too complicated!&quot; or &quot;I don&#39;t have time to learn all this!&quot; Let&#39;s be honest - if you&#39;re interested in becoming more productive, investing time in your tools is worth it. It&#39;s like learning to touch type - it takes time initially, but pays off enormously in the long run. Plus, there are tons of great resources out there to help you learn, from YouTube tutorials to friendly blog posts and clear documentation.</p>
<h2>How to start your vim journey</h2>
<p>Here&#39;s a beginner-friendly approach to getting started with Vim:</p>
<ul>
<li><p><strong>Start Small</strong>: Enable Vim mode in your current editor (most modern editors have this option). This lets you dip your toes in without diving straight into the deep end.</p>
</li>
<li><p><strong>Learn the Basics First</strong>: Focus on learning these essential movements:</p>
</li>
<li><p>Use <code>b</code> to jump backward one word (like pressing ⌥←)</p>
</li>
<li><p>Use <code>w</code> to jump forward one word (like ⌥→)</p>
</li>
<li><p>Use <code>^</code> to jump to line start (like ⌘←)</p>
</li>
<li><p>Use <code>$</code> to jump to line end (like ⌘→)</p>
</li>
<li><p><strong>Level Up Gradually</strong>: Once those feel natural, try these powerful combinations:</p>
</li>
<li><p><code>ciw</code> to change an entire word</p>
</li>
<li><p><code>di{</code> to delete everything inside curly braces</p>
</li>
<li><p><code>diW</code> to delete a WORD (including punctuation)</p>
</li>
<li><p><strong>Build Your Config</strong>: After a few weeks, when you&#39;re comfortable with the basics, start building your own configuration. Begin with just the essentials:</p>
</li>
<li><p>Add a good <a href="https://github.com/nvim-telescope/telescope.nvim">fuzzy finder</a> to help you navigate files</p>
</li>
<li><p>Don&#39;t worry about advanced features like LSP (Language Server Protocol) right away - you can write great code without it!</p>
</li>
<li><p>If you want to explore LSP later, try <a href="https://github.com/nvim-lua/kickstart.nvim">kickstart.nvim</a> as a temporary learning tool</p>
</li>
</ul>
<h2>The real reward</h2>
<p>Building your own Vim configuration is like creating your perfect workspace. While it takes some time and effort, the result is an editor that feels like an extension of your thoughts. You&#39;ll understand every part of your setup, and you&#39;ll be able to modify it exactly how you want, when you want.</p>
<p>Remember, the goal isn&#39;t to have the most complex or feature-rich setup - it&#39;s to have one that helps you work better and faster, in a way that makes sense to you. Start simple, grow gradually, and enjoy the journey of making Vim truly your own.</p>
]]></description><link>https://www.aleksandargosevski.com/build-your-own-vim-configuration-from-scratch</link><guid isPermaLink="true">https://www.aleksandargosevski.com/build-your-own-vim-configuration-from-scratch</guid><category><![CDATA[vim]]></category><category><![CDATA[productivity]]></category><category><![CDATA[neovim]]></category><pubDate>Thu, 21 Dec 2023 00:00:00 GMT</pubDate></item><item><title><![CDATA[Code is no longer written for humans]]></title><description><![CDATA[<p>For decades we cared a lot about how code looks. We argued about tabs and spaces. We wrote style guides. We set up linters to make sure everyone puts the bracket in the same place. We read books about clean code and felt good when a function was short and well named.</p>
<p>I think most of this is slowly losing its meaning. Not because it was wrong, but because the reason behind it is going away.</p>
<h2>Code was always written for humans</h2>
<p>Computers never needed readable code. They were fine with machine code. We invented high-level languages for us, the people. We wanted code that a person can write, read, and change six months later without breaking everything.</p>
<p>Clean code, naming rules, folder structure, linters, code reviews: all of it exists because people had to work with the code every day. Readable code was a tool for human collaboration. It was never the goal.</p>
<p>Now the reader is changing. More and more code is written, read, and changed by AI agents. When the main reader changes, what makes code &quot;good&quot; changes too.</p>
<h2>Agents are the next layer</h2>
<p>We already went through this once. Nobody reads the assembly that a compiler produces. We trust it because the program works, not because we checked every instruction.</p>
<p>Agents are becoming the next layer. You describe what you want, and the agent writes the code. When it needs to change something, it reads that code again. It doesn&#39;t care if a variable name is a bit long or if a file has 600 lines. It can find its way through code that would make a human give up.</p>
<p>Some will say messy code still makes agents slower. That&#39;s true today - they use more tokens on messy code, though they still finish the task. But if the agent writes the code from the start, it also organizes it. Organization doesn&#39;t go away. It becomes the agent&#39;s job, not yours.</p>
<p>The same goes for linters. Style rules and formatting made sense when ten people had to agree on how code should look. An agent doesn&#39;t need to agree with anyone.</p>
<h2>We never wrote perfect code</h2>
<p>The usual reply is: &quot;But you can&#39;t trust the machine. Someone has to read every line.&quot;</p>
<p>I think this is a double standard. We never wrote bug-free code. Code review never caught every bug. People get tired, miss edge cases, and copy the wrong snippet from Stack Overflow. An agent can make the same mistakes, but it also checks many things we forget about, and it doesn&#39;t get tired at 6 pm on a Friday.</p>
<p>So yes, responsibility stays with us. Someone has to answer when production breaks. But we don&#39;t take that responsibility by reading every line. A tech lead is responsible for the team&#39;s code without reading all of it. They do it through process, standards, and checking results.</p>
<p>We do it with:</p>
<ul>
<li>good planning before the agent writes anything</li>
<li>prompts that clearly cover edge cases</li>
<li>testing the feature ourselves, like a user would</li>
<li>tests that prove the code does what we asked</li>
</ul>
<h2>Tests are the real contract</h2>
<p>If I had to pick one thing that matters more now than before, it&#39;s tests.</p>
<p>A compiler always gives the same output for the same input. An agent doesn&#39;t. That&#39;s exactly why we need a way to check its work that doesn&#39;t depend on reading the code. Tests do that. They don&#39;t care who wrote the code or how it looks. They only care whether it works.</p>
<p>A test is also a specification. Writing a test is a clear way to tell the agent what you want. &quot;Make this pass&quot; is a better instruction than a long paragraph of text.</p>
<p>Tests only cover what you thought of, so planning and edge cases are part of the same job. But that&#39;s still a much better place for your time than arguing about how code looks.</p>
<h2>The end of the &quot;React developer&quot;</h2>
<p>When writing code is no longer the hard part, being an expert in one tool matters less. The lines between front-end and back-end, React and Python, start to fade.</p>
<p>I think every developer becomes a kind of architect. The job is to:</p>
<ul>
<li>understand the technologies you work with well enough</li>
<li>know which tool is good for which problem</li>
<li>split a problem into clear pieces</li>
<li>guide the agents to solve each piece well</li>
<li>check that the whole thing works together</li>
</ul>
<p>You still need depth. You can&#39;t judge a solution you don&#39;t understand. But you need depth to make decisions, not to type code.</p>
<h2>The people who will stand out</h2>
<p>In most teams there is someone who isn&#39;t the fastest or best coder, but who keeps making things better. They build the small tool everyone ends up using. They automate the boring task. They bring a new idea to a meeting and then actually try it.</p>
<p>Before AI, these people had one limit: time. Every idea had to be built by hand, often on the side of their normal work. Many good ideas never happened because nobody had time to build them.</p>
<p>AI removes that limit. When building is cheap, the value moves to knowing what to build. Initiative, curiosity, and good judgment start to matter more than typing speed. I think these people will be the ones who stand out in the next few years.</p>
<h2>The real shift</h2>
<p>Code is becoming a byproduct. It still matters that it works, but how it looks matters less and less.</p>
<p>The value moves from <em>how</em> to write code to <em>what</em> to build and <em>how to prove</em> it works. Write tests. Plan well. Learn many tools a little and the ideas behind them a lot. And if you&#39;ve always been the person with ideas, this is your time.</p>
]]></description><link>https://www.aleksandargosevski.com/code-is-no-longer-written-for-humans</link><guid isPermaLink="true">https://www.aleksandargosevski.com/code-is-no-longer-written-for-humans</guid><category><![CDATA[programming]]></category><category><![CDATA[ai]]></category><pubDate>Sat, 01 Aug 2026 00:00:00 GMT</pubDate></item><item><title><![CDATA[Creating a fixed and fluid column layout]]></title><description><![CDATA[<p>When it comes to designing a &quot;one column fixed and one column fluid&quot; layout, implementing a solution that is clean, robust, and doesn&#39;t rely on hacky techniques can be a challenge. We faced this issue in our office and explored various approaches. Fortunately, our <a href="https://github.com/vladimirsiljkovic">colleague</a> devised an excellent solution that I&#39;m excited to share with you.</p>
<h2>Solution</h2>
<p>To achieve this layout, we can use the following HTML structure:</p>
<pre><code class="language-html">&lt;main&gt;
  &lt;aside&gt;This is the fixed sidebar.&lt;/aside&gt;

  &lt;section&gt;This is fluid main section.&lt;/section&gt;
&lt;/main&gt;
</code></pre>
<p>And the CSS:</p>
<pre><code class="language-css">main:after {
  content: &quot;&quot;;
  display: table;
  clear: both;
}

aside {
  float: left;
  max-width: 200px;
}

section {
  overflow: hidden;
}
</code></pre>
<h2>Compatibility and Flexibility</h2>
<p>This solution gracefully supports IE6+ browsers, ensuring wider compatibility. Although it&#39;s important to note that one drawback arises when using a different overflow behavior in the fluid section. However, with no reliance on magic numbers or fixed values, this solution remains effective. Do keep in mind that until flexbox is widely supported by all major browsers, this method presents the best approach.</p>
<p>Feel free to check out the live demo on <a href="http://codepen.io/aleksandargosevski/pen/zDGvh">CodePen</a>.</p>
]]></description><link>https://www.aleksandargosevski.com/creating-a-fixed-and-fluid-column-layout</link><guid isPermaLink="true">https://www.aleksandargosevski.com/creating-a-fixed-and-fluid-column-layout</guid><category><![CDATA[css]]></category><pubDate>Fri, 02 May 2014 00:00:00 GMT</pubDate></item><item><title><![CDATA[The DRY principle is misunderstood - it's about coupling, not similarity]]></title><description><![CDATA[<p>You&#39;ve probably heard &quot;Don&#39;t Repeat Yourself&quot; a thousand times. It&#39;s one of those programming principles that sounds so obvious, so fundamental, that we rarely question it. But here&#39;s the thing - most of us are applying DRY wrong, and it&#39;s creating more problems than it solves.</p>
<h2>The common misinterpretation</h2>
<p>When developers see two components that look similar or work in a similar way, the immediate instinct is to extract the common parts. &quot;Look, both our user card and product card have rounded corners, shadows, and hover effects. Let&#39;s create a shared <code>BaseCard</code> component!&quot;</p>
<p>This seems logical. We&#39;re eliminating duplication, making our code more maintainable, right? Wrong.</p>
<h2>What DRY actually means</h2>
<p>The DRY principle isn&#39;t about avoiding similar-looking code. It&#39;s about avoiding duplication of <strong>knowledge</strong> - specifically, knowledge that will likely change together. The key insight that most developers miss is the &quot;change together&quot; part.</p>
<p>Let me give you a real example from a project I worked on. We had a user profile card and a product showcase card. They looked nearly identical - same border radius, same shadow, same padding. The team decided to create a shared component called <code>DisplayCard</code>.</p>
<p>Six months later, the design team wanted to update the user cards to have a more personal, warm feeling with softer shadows and warmer colors. The product cards needed to stay professional and sharp. Suddenly, our &quot;smart&quot; abstraction became a roadblock. We had to either:</p>
<ol>
<li>Add conditional styling based on card type (making the component more complex)</li>
<li>Break the abstraction and duplicate the code anyway</li>
<li>Compromise the design to keep both cards looking the same</li>
</ol>
<p>We ended up choosing option 2, essentially undoing our &quot;clever&quot; optimization.</p>
<h2>The real test for DRY</h2>
<p>Before extracting shared code, ask yourself this question: &quot;If I need to change this functionality or appearance in one place, am I likely to need the same change in the other places?&quot;</p>
<p>If the answer is &quot;maybe&quot; or &quot;probably not,&quot; then don&#39;t extract it. Keep the code separate, even if it looks similar.</p>
<p>Here are some examples:</p>
<p><strong>Good candidates for DRY:</strong></p>
<ul>
<li>API response formatting across your application</li>
<li>Form validation rules for the same data type</li>
<li>Error handling for network requests</li>
<li>Authentication logic</li>
</ul>
<p><strong>Bad candidates for DRY:</strong></p>
<ul>
<li>Two buttons that happen to be the same color</li>
<li>Components that share styling but serve different business purposes</li>
<li>Similar layouts for different sections of your app</li>
<li>Code that looks the same but represents different domain concepts</li>
</ul>
<h2>The coupling trap</h2>
<p>When you extract similar code into a shared component, you&#39;re creating coupling between different parts of your application. This coupling has a cost - it makes changes harder because now you have to consider the impact on multiple use cases.</p>
<p>The question isn&#39;t &quot;Is this code similar?&quot; but rather &quot;Are these pieces of code coupled in the business domain?&quot; If your user profile and product card are independent concepts that serve different purposes, they shouldn&#39;t share code just because they happen to look similar.</p>
<h2>A practical approach</h2>
<p>Instead of reflexively extracting every bit of similar code, try this approach:</p>
<ol>
<li><p><strong>Let duplication exist initially.</strong> It&#39;s easier to extract shared code later than to break apart a premature abstraction.</p>
</li>
<li><p><strong>Extract only when you have clear evidence of coupling.</strong> If you&#39;ve changed the same code in multiple places for the same business reason three times, that&#39;s a sign of true duplication.</p>
</li>
<li><p><strong>Prefer composition over inheritance.</strong> Instead of creating a base component that handles multiple concerns, create focused utilities that can be composed as needed.</p>
</li>
<li><p><strong>Question every abstraction.</strong> Before creating shared code, ask: &quot;What&#39;s the cost of maintaining this abstraction vs. the cost of occasional duplication?&quot;</p>
</li>
</ol>
<h2>The real wisdom</h2>
<p>The best code isn&#39;t the most clever or the most DRY. It&#39;s the code that adapts easily to changing requirements. Sometimes that means accepting a bit of duplication in favor of independence and flexibility.</p>
<p>Remember, you can always extract shared code later when the need becomes clear. But extracting yourself from a premature abstraction? That&#39;s much harder.</p>
<p>DRY isn&#39;t about eliminating all repetition - it&#39;s about eliminating the repetition that will hurt you when things need to change. And in software development, things always need to change.</p>
]]></description><link>https://www.aleksandargosevski.com/dry-principle-misunderstood-coupling-vs-similarity</link><guid isPermaLink="true">https://www.aleksandargosevski.com/dry-principle-misunderstood-coupling-vs-similarity</guid><category><![CDATA[programming]]></category><category><![CDATA[architecture]]></category><pubDate>Wed, 19 Jan 2022 00:00:00 GMT</pubDate></item><item><title><![CDATA[Every commit on main should have purpose]]></title><description><![CDATA[<h2>The context: different teams, different practices</h2>
<p>I work in a large team where Git flow is strictly followed - nothing gets committed directly to main. I&#39;ve noticed that developers often make small, incremental commits on their feature branches that don&#39;t represent complete functionality. This makes sense when you need a safe point to return to or want to backup work in case of hardware failure or unexpected absence.
However, while working on a side project with friends where we don&#39;t have code reviews, I noticed they apply the same small-commit practice directly to the main branch. This approach concerns me.</p>
<h2>The case against small commits on main</h2>
<p>Even during the development phase, I see little benefit in these small, incomplete commits. They primarily introduce drawbacks. Such commits lack historical significance and make the repository harder to navigate. When multiple developers add their own commits in between these small, incomplete feature commits, it becomes nearly impossible to track how a specific feature evolved over time. Looking at the git history becomes like solving a puzzle, trying to piece together which commits belong to which feature. I believe each commit should represent a complete logical unit, such as a feature or bug fix. During development, I would only accept partial feature commits if they represent a meaningful component, for example: <code>feat(leadform): add UI for lead form</code>.</p>
<h2>Arguments supporting small commits</h2>
<p>Proponents of committing directly to main offer several arguments:</p>
<ul>
<li>It allows other developers to see development direction earlier</li>
<li>It reduces the risk of large, complex merge conflicts</li>
<li>It provides clear visibility of development progress (though this can be achieved through feature branches as well)</li>
</ul>
<p>Some argue it&#39;s just simpler. However, I don&#39;t find creating branches particularly complicated. While the argument about avoiding complex merge conflicts has merit, regular rebasing and well-scoped features typically prevent such issues.</p>
<p>The underlying reason for this practice might be simpler - some developers either find Git commands intimidating, particularly operations like rebasing, or prefer the path of least resistance, choosing to commit directly to main rather than managing feature branches properly.</p>
<h2>The value of clean git history</h2>
<p>Perhaps I&#39;m particular about maintaining a &quot;perfect&quot; Git history, but throughout my career, clear history has repeatedly proved valuable. It&#39;s especially helpful during rollbacks, feature removals, parallel releases, and similar scenarios. While achieving a perfect Git history where every commit is completely safe might be unrealistic (as it would mean never introducing bugs), that shouldn&#39;t justify making the history more confusing and harder to understand.</p>
<h2>Proposed guidelines</h2>
<p>Based on my experience, I recommend these rules:</p>
<ol>
<li><p>Main branch commits should contain either:</p>
<ul>
<li>Complete features</li>
<li>Complete bug fixes</li>
</ul>
</li>
<li><p>During development phase:</p>
<ul>
<li>Partial feature commits are acceptable if they:</li>
<li>Represent a logical component</li>
<li>Enable work on dependent features</li>
</ul>
</li>
<li><p>Feature branch practices:</p>
<ul>
<li>Commits should be squashed before code review</li>
<li>Use fixup commits during review for clarity</li>
<li>Squash all fixup commits before merging to main</li>
</ul>
</li>
</ol>
<h2>Conclusion</h2>
<p>While maintaining a clean Git history requires extra effort, the benefits in terms of project maintainability and troubleshooting capabilities make it worthwhile. A well-organized commit history serves as both documentation and a safety net for your project&#39;s evolution.</p>
]]></description><link>https://www.aleksandargosevski.com/every-commit-on-main-should-have-purpose</link><guid isPermaLink="true">https://www.aleksandargosevski.com/every-commit-on-main-should-have-purpose</guid><category><![CDATA[git]]></category><pubDate>Mon, 15 Jan 2024 00:00:00 GMT</pubDate></item><item><title><![CDATA[Finding balance - The art of practical programming]]></title><description><![CDATA[<p>You know what I&#39;ve noticed after years of coding? We developers are kind of funny. We always want to write perfect code - you know, the type that would make our future selves proud. But real life isn&#39;t that simple. Sometimes we need to get things done quickly, other times we need to work with what we have. And honestly? That&#39;s completely okay. It took me a while to learn this lesson, and I want to share my experience with you.</p>
<h2>Learning from a Legacy Project</h2>
<p>I had to work on this really old project - it was about ten years old and had dozens of different developers working on it over the years. It was built using the Zend PHP framework, and when I first opened the template files, I found a complete mess of script and style tags scattered everywhere. You know that feeling when you open old code and just want to close it immediately? Yeah, that was me.</p>
<p>At first, I thought, &quot;Oh boy, what have I gotten myself into?&quot; But something interesting happened. As I spent more time with this messy but working code, I actually started enjoying it. Why? Because we knew a complete rewrite was coming soon. This gave us the freedom to focus on making things work rather than making them perfect. Plus, having all the code in one place - even if it wasn&#39;t the prettiest - made it surprisingly easy to understand how everything worked together.</p>
<h2>The Reality Check</h2>
<p>As programmers, we often dream of writing perfect code. You know the kind - neatly organized, flexible, and ready for any future changes. But here&#39;s the truth: many apps we build either get abandoned or sit untouched for years.</p>
<p>When we do come back to old projects, three things usually happen:</p>
<ol>
<li>We cringe at our old coding style (like looking at old Facebook photos)</li>
<li>We realize how much we&#39;ve learned since then</li>
<li>We discover that the tools we used are now as outdated as flip phones</li>
</ol>
<h2>Finding Your Sweet Spot</h2>
<p>So, what&#39;s the lesson here? Should we just write messy code because &quot;it works&quot;? Not exactly. The key is finding balance.</p>
<p>Here&#39;s what I&#39;ve learned:</p>
<ul>
<li>If a task is simple, keep it simple. Don&#39;t turn a garden shed into a skyscraper</li>
<li>Don&#39;t solve problems you don&#39;t have yet</li>
<li>Focus on making your code work well today while keeping tomorrow in mind</li>
</ul>
<p>Remember, good code isn&#39;t about showing off how clever you are. It&#39;s about solving real problems in a way that helps both your users and fellow developers. Sometimes, the simplest solution is the best one.</p>
]]></description><link>https://www.aleksandargosevski.com/finding-balance-the-art-of-practical-programming</link><guid isPermaLink="true">https://www.aleksandargosevski.com/finding-balance-the-art-of-practical-programming</guid><category><![CDATA[programming]]></category><pubDate>Sun, 04 Mar 2018 00:00:00 GMT</pubDate></item><item><title><![CDATA[Simple Grid Mixins]]></title><description><![CDATA[<p>Grid systems can be quite complicated. <a href="http://960.gs/">960.gs</a>, the mother of all grid systems, contains over 600 lines of code! And it&#39;s one of the simpler pure-CSS grid systems. I&#39;m not a huge fan of scattering classes throughout your markup. Some people do like this approach, of course, but it&#39;s possible to build a grid system in Sass that doesn&#39;t require gratuitous use of classes. Instead, we can use mixins and style using existing classes and markup.</p>
<p>Let&#39;s build a set of mixins that will allow us to do this. For our grid system I don&#39;t want to use floats, because sometimes I need to vertically center columns. Instead, I&#39;ll use the inline-block method which allows for vertical centering. And of course, I want the grid to be responsive.</p>
<p>Let&#39;s get started.</p>
<h2>The basic mixins</h2>
<p>First, we&#39;ll create the row mixin. Our grid will require a container which will include content for the grid. This is called a row. Here&#39;s a simple mixin to turn an element into a row:</p>
<pre><code class="language-scss">@mixin row() {
  font-size: 0;
}
</code></pre>
<p>Next, we&#39;ll create a simple column mixin for grid cells:</p>
<pre><code class="language-scss">@mixin col($align: top) {
  font-size: 16px;
  display: inline-block;
  vertical-align: $align;
}
</code></pre>
<p>You&#39;ll notice that I set the font-size to zero for the row mixin and then back to 16px for the column mixin. This is little hack to kill the default margin of inline-block elements. (Inline-block elements appear in the normal text flow of the document, left-to-right, but unlike block elements that are floated, they still need to deal with the text nodes on either side which create unwanted margin. This hack of setting the font-size to zero makes the space disappear.)</p>
<p>The column mixin also contains a handy parameter that will allow you to set the vertical alignment of a cell. This is extremely handy for aligning the cells in a row.</p>
<h2>Making the column mixin robust</h2>
<p>Let&#39;s extend the column mixin to include a way of setting the width of the column. When it comes to column width, for me it&#39;s easiest to think in terms of fractions. To create three cells that are of equal width they each need to be 1/3 the width of the containing element (the row).</p>
<p>We can extend our column mixin to allow us to pass the width as a fraction like this:</p>
<pre><code class="language-scss">@mixin col($col, $sum, $align: top) {
  width: percentage($col/$sum);
  font-size: 16px;
  display: inline-block;
  vertical-align: $align;
}
</code></pre>
<p>This will allow us to set the width of a cell to 1/3 with <code>@include col(1,3)</code>. Quite simple, eh?</p>
<p>Now let&#39;s extend this further to so that we can specify the gap between cells:</p>
<pre><code class="language-scss">@mixin col($col, $sum, $gap: 1em, $align: top) {
  width: percentage($col/$sum);
  font-size: 16px;
  display: inline-block;
  vertical-align: $align;
  box-sizing: border-box;
  padding: 0 $gap;
}
</code></pre>
<p>This is almost what we want. We can now specify the <code>$gap</code> between cells by passing it as a parameter to the column mixin: <code>@include col(1, 2, $gap: 2em)</code> (the default <code>$gap</code> is <code>1em</code>), however it won&#39;t work well for the first and last columns because they will get <code>$gap</code> padding applied before and after which isn&#39;t quite what we want.</p>
<p>To accommodate the first and last columns we can add two additional parameters:</p>
<pre><code class="language-scss">@mixin col($col, $sum, $gap: 1em, $align: top, $first: false, $last: false) {
  width: percentage($col/$sum);
  font-size: 16px;
  display: inline-block;
  vertical-align: $align;
  box-sizing: border-box;
  padding-left: if($first, 0, $gap);
  padding-right: if($last, 0, $gap);
}
</code></pre>
<p>Now we can call <code>@include col(1, 3, $first: true)</code> for the first cell, or <code>@include col(1, 3, $last: true)</code> for the final cell and it will work correctly.</p>
<p>Our final step is to make the column mixin responsive:</p>
<pre><code class="language-scss">@mixin col($col, $sum, $gap: 1em, $align: top) {
  width: 100%;
  font-size: 16px;
  display: inline-block;
  box-sizing: border-box;
  padding-left: if($first, 0, $gap);
  padding-right: if($last, 0, $gap);

  @media only screen and (min-width: 768px) {
    width: percentage($col/$sum);
    vertical-align: $align;
  }
}
</code></pre>
<p>Now, on screens less than 768 pixels wide (mobile devices) elements that use the column mixin will be as wide as their parent element, however on screens greater than 768 pixels wide (like desktop computers) cells will display at their appropriate widths.</p>
<h2>Conclusion</h2>
<p>Okay, so with just a few lines of Sass we&#39;ve created a grid system that:</p>
<ul>
<li>Can accommodate cells of any width</li>
<li>Can display optional gaps between cells</li>
<li>Handles gaps correctly for first and last columns</li>
<li>Has cells snap to the full-width of the container on mobile devices</li>
</ul>
<p>And we achieved all of this in just 16 lines of code! You can see a full demo how these mixins are used, on <a href="http://codepen.io/aleksandargosevski/full/Awuyz">CodePen</a>.</p>
]]></description><link>https://www.aleksandargosevski.com/simple-grid-mixins</link><guid isPermaLink="true">https://www.aleksandargosevski.com/simple-grid-mixins</guid><category><![CDATA[sass]]></category><category><![CDATA[grid]]></category><category><![CDATA[css]]></category><pubDate>Sat, 07 Nov 2015 00:00:00 GMT</pubDate></item><item><title><![CDATA[Simplifying Backbone.js view management with Vojvoda]]></title><description><![CDATA[<p>Managing views effectively in Backbone.js is a significant aspect that requires attention. While working with Backbone.js, it can be challenging to keep track of all view instances and properly manage them. The library itself does not handle this for you, making you responsible for tasks like memory management and event listeners. Failing to do so can lead to memory leaks, slowing down your application, or even experiencing &quot;ghost views&quot; that can cause UI issues.</p>
<p>In order to address this issue, I have developed a small library called <a href="https://github.com/aleksandargosevski/vojvoda">Vojvoda</a> to assist my team in managing views more conveniently. Although it would be ideal for Backbone.js to provide this functionality by default, that is not currently the case. Vojvoda is an extension for views that does not impose any specific project structure or make decisions on your behalf. You can choose to use it selectively for certain views or for all views within your application. We have utilized a BaseView, which extends Vojvoda view, to incorporate additional features we require in every view. Vojvoda seamlessly integrates with both <a href="">require.js</a> and <a href="">browserify</a>.</p>
<p>Allow me to provide a brief description of the API:</p>
<p>To create a view using Vojvoda, simply extend it as follows:</p>
<pre><code class="language-js">var SomeView = Vojvoda.extend({
  // Your view logic here
});
</code></pre>
<p>For managing subviews, the library offers several methods:</p>
<p>Adding a subview:</p>
<pre><code class="language-js">this.addSubView(&quot;gallery&quot;, GalleryView, {
  model: new Backbone.Model(images),
});
</code></pre>
<p>Removing a subview:</p>
<pre><code class="language-js">this.destroySubView(&quot;gallery&quot;);
</code></pre>
<p>Removing all subviews:</p>
<pre><code class="language-js">this.destroyAllSubViews();
</code></pre>
<p>I invite you to explore the <a href="https://github.com/aleksandargosevski/vojvoda/blob/master/index.js">Vojvoda code on GitHub</a>. It is a simple library, and examining the code will provide you with a clearer understanding of why such a tool can be beneficial. Feel free to reach out if you have any further questions or need additional assistance. Happy coding!</p>
]]></description><link>https://www.aleksandargosevski.com/simplifying-backbonejs-view-management-with-vojvoda</link><guid isPermaLink="true">https://www.aleksandargosevski.com/simplifying-backbonejs-view-management-with-vojvoda</guid><category><![CDATA[javascript]]></category><category><![CDATA[backbonejs]]></category><pubDate>Mon, 03 Feb 2014 00:00:00 GMT</pubDate></item><item><title><![CDATA[Spriting with Sass and Compass]]></title><description><![CDATA[<p>As web developers have become more concerned about browser performance a technique called “image spriting” has emerged that is designed to reduce the number of requests made to the server. As it turns out, fewer requests made the server (when there is no significant difference in the combined size of the files delivered) can make a big difference in how fast a page appears to download.</p>
<p>Image spriting works by combining a bunch of images (called “sprites”) into one large image (or “sprite sheet”) to significantly reduce the number of requests made to the server. Then, with clever use of <code>background-position</code> only part of the sprite sheet is revealed each time an image is needed.</p>
<p>Here’s an example sprite sheet for a set of toolbar of icons:</p>
<figure class="figure">
  <img class="figure-image" src="/content/sprite-sheet.svg" alt="A sprite sheet">
  <figcaption class="figure-caption">A &#8220;sprite sheet&#8221; with grid lines overlayed to illustrate how it is assembled.</figcaption>
</figure><p>Given the image above, we could write the following styles for the media icon:</p>
<pre><code class="language-scss">$icon-width: 24px;
$icon-height: 24px;
$icons: image-url(&quot;toolbar.png&quot;);

.media-icon {
  background-image: $icons;
  background-position: -($icon-width * 5) -($icon-height * 1);
  width: $icon-width;
  height: $icon-height;
}
</code></pre>
<p>What this does is shift the background image 5 tiles in the X direction and 1 tile in the Y direction so that the media icon is revealed:</p>
<figure class="figure">
  <img class="figure-image" src="/content/sprite-sheet-position.svg" alt="A sprite sheet">
  <figcaption class="figure-caption">By shifting the <code>background-position</code> of the containing element the correct sprite can be shown.</figcaption>
</figure><p>One downside to image spriting is that sprite sheets are notoriously difficult to maintain. Adding a new image requires updating both the image and the related CSS. Matters are made even worse if you decide to remove a sprite. What do you do then? Rejigger the entire sprite sheet?</p>
<h2>Compass to the rescue!</h2>
<p>Fortunately for us, Chris Eppstein’s <a href="http://beta.compass-style.org">Compass</a> project includes a robust suite of tools for creating and maintaining sprite sheets automatically. Compass can build your sprite sheet image, give you the coordinates of each sprite, allow you to control the layout and spacing of the sprites, and write the SCSS necessary to display each image. In short, Compass’s sprite tools will save you a ton of effort.</p>
<p>I’m not going to go over getting started with Compass here. If you are not familar with Compass please check out some tutorials before continuing.</p>
<h2>Folder structure</h2>
<p>The basic idea behind spriting in Compass is that you drop your sprite images inside of a folder in your <code>images/</code> folder and Compass will use your source images to build the much larger sprite sheet image. For our toolbar example the <code>images/</code> folder would look something like this:</p>
<pre><code class="language-md">images/
|
`-- toolbar/
|-- bold.png
|-- italic.png
|-- link.png
|-- code.png
|-- unordered-list.png
|-- ordered-list.png
...
</code></pre>
<p>Keep in mind that you should only put images inside of your sprite sheet folder that you want to be part of the final sprite sheet. Compass will use every image it finds in a sprite sheet folder to assemble the final image.</p>
<h2>The easy way</h2>
<p>The easiest way to build your sprite sheet is to use the Compass’s magic import directive:</p>
<pre><code class="language-scss">@import &quot;images/toolbar/*.png&quot;;
</code></pre>
<p>When Compass sees a &quot;*.png&quot; pattern in an import directive it assumes it is a folder of sprites that needs to be converted into a sprite sheet. It will then assemble a sprite sheet image for you and include a number of custom mixins to make it easy to access the sprites in your project.</p>
<p>One of those mixins can be used to generate custom classes for all of your sprites automatically. The name of the mixin is based on the name of the folder where the sprite sheet source images are located. In our example:</p>
<pre><code class="language-scss">@include all-toolbar-sprites;
</code></pre>
<p>Will output the following CSS:</p>
<pre><code class="language-css">.toolbar-sprite,
.toolbar-bold,
.toolbar-italic,
.toolbar-link {
  background-image: url(&quot;../images/toolbar-s1f1c6cbfd0.png&quot;);
  background-repeat: no-repeat;
}

.toolbar-bold {
  background-position: 0 0;
}

.toolbar-italic {
  background-position: 0 -24px;
}

.toolbar-link {
  background-position: 0 -48px;
}
</code></pre>
<p>Notice that Compass has built the “toolbar-s1f1c6cbfd0.png” image for us automatically. This is our sprite sheet. The name of the file is the name of our sprite sheet (in this case “toolbar”) plus a funny series of letters and numbers called a “hash.” The hash will change whenever you update the sprite sheet so that cached CSS will know to use the updated image.</p>
<h2>Controlling class names</h2>
<p>If you want more control over the generated output, don’t use the <code>all-{FOLDER NAME}-sprites</code> mixin. Instead, Compass provides a mixin to ouput the CSS needed for one sprite:</p>
<pre><code class="language-scss">@import &quot;images/toolbar/*.png&quot;;

.bold-icon {
  @include toolbar-sprite(bold);
}
.italic-icon {
  @include toolbar-sprite(italic);
}
.link-icon {
  @include toolbar-sprite(link);
}
</code></pre>
<p>Again, this mixin is named based on the name of your sprite sheet. In our example the name of the mixin is <code>toolbar-sprite</code>.</p>
<h2>Sprite maps</h2>
<p>If you really want to get low-level, Compass provides another tool called a sprite map that allows you have control over how your sprite sheets are built.</p>
<p>Instead of using the magic import directive, create a sprite map like this:</p>
<pre><code class="language-scss">$icons: sprite-map(&quot;toolbar/*.png&quot;);

.bold-icon {
  background: sprite($icons, bold);
}
.italic-icon {
  background: sprite($icons, italic);
}
.link-icon {
  background: sprite($icons, link);
}
</code></pre>
<p>Notice that instead of using a sprite sheet specific mixin as we did in the class name example above, now need use the generic <code>sprite</code> mixin with our newly created sprite map.</p>
<h2>Controlling spacing</h2>
<p>Sometimes it’s useful to specify that sprites should be separated by a certain amount of white space.</p>
<p>To set spacing around each icon:</p>
<pre><code class="language-scss">// Using import...
$toolbar-spacing: 5px;
@import &quot;toolbar/*.png&quot;;

// Or, if you are using a sprite map...
$icons: sprite-map(&quot;toolbar/*.png&quot;, $spacing: 5px);
</code></pre>
<h2>Controlling layout</h2>
<p>Compass supports a few different ways of laying out your sprite sheet:</p>
<figure class="figure">
  <img class="figure-image" src="/content/sprite-sheet-layout.svg" alt="A sprite sheet">
  <figcaption class="figure-caption">There are 4 types of layout - vertical, horizontal, diagonal, and smart.</figcaption>
</figure><p>To set the layout of sprites on the sprite sheet:</p>
<pre><code class="language-scss">// Using import...
$toolbar-spacing: 5px;
$toolbar-layout: &quot;smart&quot;;
@import &quot;toolbar/*.png&quot;;

// Or, if you are using a sprite map...
$icons: sprite-map(&quot;toolbar/*.png&quot;, $spacing: 5px, $layout: diagonal);
</code></pre>
<p><strong>Note:</strong> In the current version of Compass, you can’t use spacing and smart layout in the same time. For all layouts check out link in last section of article about sprite layouts.</p>
<h2>Additional functions and mixins</h2>
<p>Compass also provides a number of helpful mixins and functions for working with sprite maps:</p>
<ul>
<li><code>sprite-url($icons)</code> - Returns the URL of a sprite sheet.</li>
<li><code>sprite-position($icons, bold)</code> - Returns the X and Y position of a sprite on the sprite sheet.</li>
<li><code>@include sprite-dimensions($icons, link)</code> - Set width and height of a sprite based on its original dimensions.</li>
</ul>
<p>Usage:</p>
<pre><code class="language-scss">$icons: sprite-map(&quot;toolbar/*.png&quot;, $spacing: 5px, $layout: diagonal);
.bold-icon {
  background-image: sprite-url($icons);
  background-position: sprite-position($icons, bold);
  @include sprite-dimensions($icons, bold);
}
</code></pre>
<h2>Digging deeper</h2>
<p>Believe it or not, there’s actually a lot more that you can do with Compass sprite sheets. More than I can cover in this simple tutorial. If you’re interested in learning more read the <a href="http://beta.compass-style.org/help/tutorials/spriting/">official Spriting Tutorial</a> and checkout <a href="http://beta.compass-style.org/search/?q=sprites">some of other docs here</a>.</p>
]]></description><link>https://www.aleksandargosevski.com/spriting-with-sass-and-compass</link><guid isPermaLink="true">https://www.aleksandargosevski.com/spriting-with-sass-and-compass</guid><category><![CDATA[css]]></category><category><![CDATA[sass]]></category><pubDate>Sun, 23 Mar 2014 00:00:00 GMT</pubDate></item><item><title><![CDATA[The Mighty Ansible]]></title><description><![CDATA[<p>I&#39;ve always been fascinated by automated provisioning tools, but I often found them needlessly complicated. However, my perspective changed completely when a <a href="https://www.linkedin.com/in/djordjeparovic/">friend</a> took just five minutes to explain how <a href="https://www.ansible.com/">Ansible</a> works and how straightforward it is to set up a new project.</p>
<h2>What are Automated Provisioning Tools?</h2>
<p>Think of automated provisioning tools as your personal IT assistant. They help you set up and manage multiple servers automatically, saving you from the tedious task of manually configuring each server one by one. Instead of logging into hundreds of machines individually, tools like Ansible do the heavy lifting for you, setting up everything simultaneously.</p>
<h2>Ansible: Simplicity and Efficiency Combined</h2>
<p>Ansible&#39;s magic lies in its simplicity. It uses SSH to connect to your servers and runs your specified tasks – no complicated setup needed! What makes it special is that it uses Python, which comes pre-installed on most systems, making it a &quot;zero-installation&quot; solution for your target machines. After completing its tasks, Ansible cleans up automatically, leaving your servers pristine.</p>
<p>One of Ansible&#39;s best features is its use of simple YAML files to define tasks. These files are just plain text, making them perfect for version control with Git. This means you can track every change made to your server configurations, just like you would with regular code.</p>
<h2>Getting Started</h2>
<p>Starting with Ansible is surprisingly easy! Install it on your computer and use Vagrant to create virtual machines for practice. This setup lets you build and test your infrastructure locally before deploying to real servers – just change the IP addresses in your config file when you&#39;re ready to go live.</p>
<p>While there are many tutorials available, here are some essential resources to begin your Ansible journey:</p>
<ul>
<li><a href="https://docs.ansible.com">Ansible Docs</a></li>
<li><a href="https://galaxy.ansible.com">Ansible Galaxy (community-created tasks)</a></li>
<li><a href="https://github.com/ansible/ansible-examples">Simple Ansible examples</a></li>
</ul>
]]></description><link>https://www.aleksandargosevski.com/the-mighty-ansible</link><guid isPermaLink="true">https://www.aleksandargosevski.com/the-mighty-ansible</guid><category><![CDATA[ansible]]></category><category><![CDATA[devops]]></category><pubDate>Tue, 02 May 2017 00:00:00 GMT</pubDate></item><item><title><![CDATA[Thoughts on CSS Frameworks]]></title><description><![CDATA[<p>In the realm of web development, CSS frameworks like Foundation and Bootstrap have gained immense popularity. However, it is important to critically examine their usage and understand their drawbacks. In this blog post, I will share my perspective on CSS frameworks, highlight their flaws, and discuss situations where they can be beneficial.</p>
<h2>Learning: The Bootstrap Syndrome</h2>
<p>One common trend among newcomers and junior developers is what I like to call the &quot;Bootstrap Syndrome.&quot; Often, they first delve into using frameworks like Bootstrap and Foundation before gaining a solid understanding of core CSS concepts. To illustrate this point, my friend humorously compares it to giving a fire hose to a kid and turning on the water.</p>
<p>While frameworks can be valuable for learning, it&#39;s essential to prioritize understanding the underlying principles of CSS. By using frameworks, you can grasp helpful techniques like image replacement and grid setups. These frameworks introduce smart concepts that can enhance your CSS skills.</p>
<h2>Performance</h2>
<p>Let&#39;s address the elephant in the room. CSS frameworks are undeniably hefty. Consider the examples of Bootstrap, which weighs around 100kb when minified, and Foundation, which comes in at approximately 115kb. Although you can cherry-pick specific components, many developers are unaware of the inner workings of the included grid system. In truth, most wouldn&#39;t utilize it if they possessed a deeper understanding of CSS grid concepts. Before incorporating a framework, it&#39;s worth asking yourself if your design truly necessitates a grid structure or if a more tailored solution would suffice. Don&#39;t overlook the simplicity of creating your own grid, as explained in this helpful <a href="https://css-tricks.com/dont-overthink-it-grids/">guide</a>.</p>
<h2>When to Utilize CSS Frameworks</h2>
<p>While CSS frameworks have their downsides, there are situations where they prove useful. They shine in scenarios involving wireframes, presentations, or the creation of admin panels. For developers who aren&#39;t extensively acquainted with CSS, frameworks can expedite the layout creation process.</p>
<h2>Embracing Boilerplates</h2>
<p>In a nutshell, consider embracing boilerplates as an alternative approach. Craft your starter folder or boilerplate, equipped with a personal collection of frequently used mixins and styles. By starting from scratch rather than relying on extensive pre-written code, you&#39;ll have a leaner foundation tailored precisely to your project&#39;s needs.</p>
<h2>Conclusion</h2>
<p>To conclude, Bootstrap and Foundation are undeniably excellent resources, and studying their code can be enlightening. However, it&#39;s important to exercise caution and avoid a one-size-fits-all mentality. In most cases, you likely won&#39;t require the full extent of these frameworks. So, be mindful of their weight and explore alternatives that allow you to strike a balance between convenience and efficiency.</p>
<p>Remember, CSS frameworks are valuable tools, but they should not be your default choice for every project. Aim to be discerning, leverage your growing CSS expertise, and use frameworks judiciously to enhance your development process.</p>
]]></description><link>https://www.aleksandargosevski.com/thoughts-on-css-frameworks</link><guid isPermaLink="true">https://www.aleksandargosevski.com/thoughts-on-css-frameworks</guid><category><![CDATA[css]]></category><pubDate>Tue, 23 Sep 2014 00:00:00 GMT</pubDate></item></channel></rss>