{"@attributes":{"version":"2.0"},"channel":{"title":"Blog on Francis Sunday","link":"https:\/\/codehakase.com\/blog\/","description":"Recent content in Blog on Francis Sunday","generator":"Hugo","language":"en-us","lastBuildDate":"Tue, 03 Mar 2026 00:00:00 +0000","item":[{"title":"The Database Is a Cache","link":"https:\/\/codehakase.com\/blog\/the-database-is-a-cache\/","pubDate":"Tue, 03 Mar 2026 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/the-database-is-a-cache\/","description":"<p>The default way to build a data-backed application is database-first. Design a schema, build an application that reads and writes to it, render the results. The database is the source of truth. Everything else is downstream.<\/p>\n<p>This made sense because applications could only operate on structured data. A billing system needed an <strong>invoices<\/strong> table with amounts, due dates, and payment statuses in well-defined columns. It couldn&rsquo;t look at a signed contract PDF and figure out the payment terms on its own.<\/p>"},{"title":"Bounded Execution for AI Coding Agents","link":"https:\/\/codehakase.com\/blog\/bounded-execution-for-ai-coding-agents\/","pubDate":"Fri, 09 Jan 2026 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/bounded-execution-for-ai-coding-agents\/","description":"<p>I do a lot of AI-assisted programming across my personal projects, studio work, codebase search at my day job. My preference is CLI-based agents, where <a href=\"https:\/\/claude.com\/product\/claude-code?ref=codehakase.com\">Claude Code<\/a> and <a href=\"https:\/\/ampcode.com?ref=codehakase.com\">Amp<\/a> excel. For some tasks, I prefer the <a href=\"https:\/\/ghuntley.com\/ralph?ref=codehakase.com\">Ralp Wiggum<\/a> pattern (fire-and-forget with checkpoints), other times I prefer to be in the loop.<\/p>\n<p>I mostly utilise smaller threads so I don&rsquo;t get the agent drunk on context. One pattern kept emerging: I&rsquo;d ask the agent to &ldquo;keep fixing until the tests pass&rdquo; or &ldquo;deploy and verify the health check succeeds,&rdquo; and I&rsquo;d find myself babysitting the process. The agent would make progress, hit an error, try again, and I have to be on standby to send a &ldquo;Continue&rdquo; text. This led me to build <a href=\"https:\/\/github.com\/codehakase\/alpf?ref=codehakase.com\">alpf<\/a> (Agentic Loop with Promise Fulfilment) - a CLI tool that wraps any task executor with bounded execution guarantees. The interesting part isn&rsquo;t the tool itself, but how it changes the way I work with AI coding agents.<\/p>"},{"title":"Idiomatic Haskell Refactors","link":"https:\/\/codehakase.com\/blog\/idiomatic-haskell-refactors\/","pubDate":"Sun, 19 Oct 2025 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/idiomatic-haskell-refactors\/","description":"<p>I was reviewing my notes for previous idiomatic Haskell refactoring patterns I&rsquo;ve recorded, and I can see some entries that are interesting to share. Some were confusing at first, but looking at them from first principles, weighing the gains in terms of brevity and\/or performance, they&rsquo;ve become clearer and essential to how I write Haskell code.<\/p>\n<p>Here are some of the patterns that made the biggest difference:<\/p>\n<h3 id=\"bind-to-lambda-case\">Bind to Lambda Case:<\/h3>\n<p>Enabled via the <code>LambdaCase<\/code> language extension, we can rewrite pattern matching blocks to omit identifiers that are only used in the pattern match, like in the example below where we have a <code>userM<\/code> variable only used in the pattern match.<\/p>"},{"title":"Maps Don't Shrink in Go","link":"https:\/\/codehakase.com\/blog\/maps-dont-shrink-in-go\/","pubDate":"Tue, 27 May 2025 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/maps-dont-shrink-in-go\/","description":"<p>Maps in Go are built-in data structures that provide a way to store key-value pairs. They are similar to dictionaries or hash tables in other programming languages. Maps are unordered collections, meaning that the order of elements is not guaranteed.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#a90d91\">func<\/span> <span style=\"color:#000\">main<\/span>() {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#000\">m<\/span> <span style=\"color:#000\">:=<\/span> <span style=\"color:#a90d91\">make<\/span>(<span style=\"color:#a90d91\">map<\/span>[<span style=\"color:#a90d91\">string<\/span>]<span style=\"color:#a90d91\">string<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#000\">m<\/span>[<span style=\"color:#c41a16\">&#34;name&#34;<\/span>] = <span style=\"color:#c41a16\">&#34;Didi&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#000\">m<\/span>[<span style=\"color:#c41a16\">&#34;city&#34;<\/span>] = <span style=\"color:#c41a16\">&#34;Lagos&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#000\">fmt<\/span>.<span style=\"color:#000\">Println<\/span>(<span style=\"color:#000\">m<\/span>) \n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#177500\">\/\/ Output: map[city:Lagos name:Didi]<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>Go maps are designed to <strong>grow<\/strong> as the data they hold increases, but they generally <strong>do not shrink<\/strong> back down if elements are removed. When you add key-value pairs, they are stored in structures called <strong>buckets<\/strong>. If a map starts to fill up, it will eventually trigger a <strong>growth operation<\/strong>. This typically happens under one of two conditions:<\/p>"},{"title":"Notes on building a coding agent","link":"https:\/\/codehakase.com\/blog\/notes-on-building-a-coding-agent\/","pubDate":"Fri, 25 Apr 2025 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/notes-on-building-a-coding-agent\/","description":"<p>I just finished reading Thorsten Ball&rsquo;s article on Ampcode, <a href=\"https:\/\/ampcode.com\/how-to-build-an-agent?ref=codehakase.com\">How to build an agent<\/a>, and wanted to note my thoughts. Going into it, I kind of expected a deep dive into complex engineering, maybe some heavy AI theory behind coding agents. But the main thrust of the piece was surprisingly different. It argues that building these agents doesn&rsquo;t necessarily involve arcane secrets. Thorsten makes a strong case that with the right model (like Anthropic&rsquo;s Claude) and a good SDK, a lot of the work boils down to setting up relatively standard boilerplate code.<\/p>"},{"title":"Functors: Identity, Composition, and fmap","link":"https:\/\/codehakase.com\/blog\/functors-identity-composition-and-fmap\/","pubDate":"Wed, 26 Mar 2025 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/functors-identity-composition-and-fmap\/","description":"<p>In writing software, we often encounter scenarios where a value resides within a context, a container of sorts. Standard function application, so straightforward with simple values, presents a challenge in these situations. Consider the <code>Maybe<\/code> data type in Haskell, which encapsulates the possibility of a value&rsquo;s absence. Applying functions to values wrapped in <code>Maybe<\/code> requires a different approach, as direct function application results in a type error.<\/p>\n<p>For example, applying the function <code>(+4)<\/code> to the integer <code>2<\/code> is trivial:<\/p>"},{"title":"Largest product in a series","link":"https:\/\/codehakase.com\/blog\/largest-product-in-a-series\/","pubDate":"Fri, 07 Feb 2025 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/largest-product-in-a-series\/","description":"<p>First post on this blog after a long hiatus &ndash; hopefully, this will stick. I was cleaning up my browser tabs, and found a Project Euler window open and decided to attempt some problems in Haskell. I&rsquo;ve been writing Haskell for a couple of months now, and it was a great way to test myself. I picked one of the problems I attempted, a simple one &ndash; <a href=\"https:\/\/projecteuler.net\/problem=8\">Problem 8: Largest product in a series<\/a>.<\/p>"},{"title":"Working with JSON in Go","link":"https:\/\/codehakase.com\/blog\/working-with-json-in-go\/","pubDate":"Mon, 03 May 2021 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/working-with-json-in-go\/","description":"<blockquote>\n<p>Summary: I&rsquo;ve worked with JSON in various programming languages in context to data exchange\/communication between applications. In this article, I&rsquo;ll give a brief overview of the encoding\/json package in Go, and point some gotchas I&rsquo;ve encountered.<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.json.org\">JSON<\/a> (JavaScript Object Notation), is a popular data interchange format commonly used for communication between applications. Working with JSON in Go is stress-free thanks to the <a href=\"https:\/\/golang.org\/pkg\/encoding\/json\">encoding\/json<\/a> package from the standard library.<\/p>\n<h2 id=\"encoding-and-decoding-data\">Encoding and decoding data<\/h2>\n<p>To encode or decode data we use the <a href=\"https:\/\/golang.org\/pkg\/encoding\/json\/#Marshal\">Marshal<\/a> and <a href=\"https:\/\/golang.org\/pkg\/encoding\/json\/#Unmarshal\">Unmarshal<\/a> functions from the json package. Both methods have the following signatures:<\/p>"},{"title":"Enum Stringer Interface optimisation in Go","link":"https:\/\/codehakase.com\/blog\/enum-stringer-interface-optimisation-in-go\/","pubDate":"Thu, 08 Apr 2021 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/enum-stringer-interface-optimisation-in-go\/","description":"<p>The most idiomatic way of describing an enum type in Go is to use constants, often in conjunction with <a href=\"https:\/\/golang.org\/ref\/spec#Iota\">iota<\/a>.<\/p>\n<p>A pattern I&rsquo;ve used to implement the <code>Stringer<\/code> interface for an enum type is to lookup the string representation in a slice. Consider this snippet from a project I&rsquo;m working on:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#177500\">\/\/ Status ...<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a90d91\">type<\/span> <span style=\"color:#000\">Status<\/span> <span style=\"color:#a90d91\">uint32<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#177500\">\/\/ List of possible status values<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a90d91\">const<\/span> (\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#177500\">\/\/ The operation is known, but hasn&#39;t been decided yet<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#000\">Processing<\/span> <span style=\"color:#000\">Status<\/span> = <span style=\"color:#a90d91\">iota<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#177500\">\/\/ The operation will never be accepted<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#000\">Rejected<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#177500\">\/\/ The operation was accepted<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#000\">Accepted<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#000\">...<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a90d91\">func<\/span> (<span style=\"color:#000\">s<\/span> <span style=\"color:#000\">Status<\/span>) <span style=\"color:#000\">String<\/span>() <span style=\"color:#a90d91\">string<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a90d91\">return<\/span> []<span style=\"color:#a90d91\">string<\/span>{<span style=\"color:#c41a16\">&#34;processing&#34;<\/span>, <span style=\"color:#c41a16\">&#34;rejected&#34;<\/span>, <span style=\"color:#c41a16\">&#34;accepted&#34;<\/span>}[<span style=\"color:#000\">s<\/span>]\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>The snippet above works correct but has a few glitches &ndash; passing <code>Status(-2)<\/code> or <code>Status(300)<\/code> will cause the <code>String()<\/code> method to panic, and when appending to the slice, the order of the enum constants has to be taken into consideration.<\/p>"},{"title":"Line Numbers In Vim","link":"https:\/\/codehakase.com\/blog\/line-numbers-in-vim\/","pubDate":"Fri, 07 Feb 2020 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/line-numbers-in-vim\/","description":"<p>Vim doesn&rsquo;t show line numbers by default, they can be turned on in your vim configuration. Vim has an absolute, relative and hybrid line numbering mode.\n<img src=\"https:\/\/res.cloudinary.com\/hakase-labs\/image\/upload\/v1581043109\/bare_setup_mzb8rd.gif\" alt=\"\"><\/p>\n<h2 id=\"absolute-line-numbers\">Absolute Line Numbers<\/h2>\n<p>Addding the <code>number<\/code> option to your vim config, Vim sets up absolute line numbers to show the line number for each line in the current buffer.\n<img src=\"https:\/\/res.cloudinary.com\/hakase-labs\/image\/upload\/v1581043108\/absolute_numbers_q1z6ku.gif\" alt=\"\"><\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-vim\" data-lang=\"vim\"><span style=\"display:flex;\"><span><span style=\"color:#177500\">&#34; set absolute numbers<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a90d91\">set<\/span> <span style=\"color:#000\">number<\/span> <span style=\"color:#177500\">&#34; or<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a90d91\">set<\/span> <span style=\"color:#000\">nu<\/span>\n<\/span><\/span><\/code><\/pre><\/div><h2 id=\"relative-line-numbers\">Relative Line Numbers<\/h2>\n<p>With the <code>relativenumber<\/code> option, each line in your file is numbered relative to the cursor\u2019s current position.\n<img src=\"https:\/\/res.cloudinary.com\/hakase-labs\/image\/upload\/v1581043108\/relative_numbers_prnvbk.gif\" alt=\"\"><\/p>"},{"title":"What I Use","link":"https:\/\/codehakase.com\/blog\/what-i-use\/","pubDate":"Fri, 10 Jan 2020 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/what-i-use\/","description":"<p>For the few times I have to tell people in detail the software and hardware I use on a day to day basis to do my job, here&rsquo;s a post to list them. My setup changes from time to time but I&rsquo;ll try to keep this up to date. My dotfiles can be found on <a href=\"https:\/\/github.com\/codehakase\/dotfiles\">This Repo<\/a> - they work for me, read carefully before installing for yourself.<\/p>\n<h2 id=\"hardware\">Hardware<\/h2>\n<ul>\n<li>HP 24&quot; Monitor: HP24y IPS Display<\/li>\n<li>MacBook Pro 13&quot; (2017)\n<ul>\n<li>2.3 GHz Dual-Core Intel Core i5<\/li>\n<li>128GB SSID<\/li>\n<li>8GB of 2133 MHz LPDDR3<\/li>\n<\/ul>\n<\/li>\n<li>Havit Keyboard<\/li>\n<\/ul>\n<h2 id=\"development\">Development<\/h2>\n<ul>\n<li>Vim<\/li>\n<li>Visual Studio Code\n<ul>\n<li>Font: Fira Code<\/li>\n<li>Theme: Hyper<\/li>\n<\/ul>\n<\/li>\n<li>ITerm2\n<ul>\n<li>Shell: ZSH (Oh My ZSH)<\/li>\n<li>Font: Fira Code<\/li>\n<\/ul>\n<\/li>\n<li>Alacritty (GPU accelerated terminal)<\/li>\n<li>Docker\n<ul>\n<li>Minikube (k8s)<\/li>\n<\/ul>\n<\/li>\n<li>Google Chrome<\/li>\n<li>Sequel Pro<\/li>\n<\/ul>\n<h2 id=\"hosting\">Hosting<\/h2>\n<ul>\n<li>AWS<\/li>\n<li>Digital Ocean<\/li>\n<li>Netlify<\/li>\n<li>Cloudinary - Media files<\/li>\n<\/ul>\n<h2 id=\"workflow\">Workflow<\/h2>\n<ul>\n<li>Notion<\/li>\n<li>Bear App<\/li>\n<li>Slack<\/li>\n<li>Spark Mail<\/li>\n<li>1Password<\/li>\n<\/ul>\n<h2 id=\"businessfinance\">Business\/Finance<\/h2>\n<ul>\n<li>Fresh Books - Invoicing and accounting<\/li>\n<li>Google Sheets<\/li>\n<\/ul>\n<h2 id=\"entertainment\">Entertainment<\/h2>\n<ul>\n<li>Spotify<\/li>\n<li>Amazon Music<\/li>\n<li>Sony WH-1000XM3 Headphones (best headphone I&rsquo;ve used so far)<\/li>\n<li>Alexa Echo Dot 3<\/li>\n<\/ul>\n<p>Want to recommend a gear or app? Leave a comment!<\/p>"},{"title":"Building Small Containers for Kubernetes","link":"https:\/\/codehakase.com\/blog\/building-small-containers-for-kubernetes\/","pubDate":"Sat, 01 Dec 2018 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/building-small-containers-for-kubernetes\/","description":"<p>The first step to deploying any app to <a href=\"https:\/\/kubernetes.io\">Kubernetes<\/a>, is to bundle the app in a container. There are several official, and community-backed container images for various languages and distros, and most of these containers can be really large, or sometimes contain overheads your app may never need\/use.<\/p>\n<p>Thanks to <a href=\"https:\/\/docker.io\">Docker<\/a>, you can easily create container images in a few steps; specify a base image, add your app-specific changes, and build your container.<\/p>"},{"title":"Building a Web App With Go, Gin and React","link":"https:\/\/codehakase.com\/blog\/building-a-web-app-with-go-gin-and-react\/","pubDate":"Fri, 20 Apr 2018 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/building-a-web-app-with-go-gin-and-react\/","description":"<p><strong>TL;DR:<\/strong> In this tutorial, I&rsquo;ll show you how easy it is to build a web application with Go and the Gin framework and add authentication to it. Check out the Github <a href=\"https:\/\/github.com\/codehakase\/golang-gin\">repo<\/a> for the code we&rsquo;re going to write.<\/p>\n<hr>\n<p><strong>Gin<\/strong> is a high-performance micro-framework that delivers a very minimalistic framework that carries with it only the most essential features, libraries, and functionalities needed to build web applications and microservices. It makes it simple to build a request handling pipeline from modular, reusable pieces. It does this by allowing you to write middleware that can be plugged into one or more request handlers or groups of request handlers.<\/p>"},{"title":"The CouchDB Replicator Database - An Overview","link":"https:\/\/codehakase.com\/blog\/the-couchdb-replicator-database-an-overview\/","pubDate":"Thu, 19 Apr 2018 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/the-couchdb-replicator-database-an-overview\/","description":"<p><strong>TL;DR:<\/strong> In this article, I&rsquo;ll give an overview of the replicator database in CouchDB, how to spin off a replication task in CouchDB<\/p>\n<hr>\n<p><strong>CouchDB<\/strong> is a database that completely embraces the web. CouchDB stores your data as JSON documents, and allows you access these documents easily, from a web interface or its <a href=\"http:\/\/docs.couchdb.org\/en\/2.1.1\/api\/basics.html#api-basics\">REST API<\/a>. We won&rsquo;t be going too deep into couchdb as it would be out of scope for this article - I&rsquo;ll write one of those pretty soon.<\/p>"},{"title":"Here's What's New In Go 1.10","link":"https:\/\/codehakase.com\/blog\/heres-whats-new-in-go-1.10\/","pubDate":"Tue, 06 Mar 2018 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/heres-whats-new-in-go-1.10\/","description":"<blockquote>\n<p>Go 1.8 is one year old (Happy belated Birthday \ud83c\udf8a \ud83c\udf89)\nGo 1.9 is already 6 months old!\nGo 1.10 is out \u270c<\/p><\/blockquote>\n<p>The latest Go release, <strong>v1.10<\/strong> arrived six months after V1.9. This release was stated in the change-logs and the Go blog. I&rsquo;m gonna share some interesting changes I&rsquo;ve found in Go 1.10 with you.<\/p>\n<h2 id=\"new-features\">New Features<\/h2>\n<h3 id=\"the-language\">The Language<\/h3>\n<p>Go 1.10 offers compiler tool chain and performance improvements, but no significant changes was made to the language&rsquo;s specification.<\/p>"},{"title":"React Native vs Ionic - A Quick Comparison","link":"https:\/\/codehakase.com\/blog\/react-native-vs-ionic-a-quick-comparison\/","pubDate":"Tue, 05 Dec 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/react-native-vs-ionic-a-quick-comparison\/","description":"<p><img src=\"https:\/\/cdn.scotch.io\/23499\/HDDv8v7TRhqt4ao1nwfH_React_Native_vs_Ionic_m5b5ol.png.jpg\" alt=\"&ldquo;React Native vs Ionic&rdquo;\"><\/p>\n<p>The main purpose of this article, is to highlight the important differences between Ionic and React Native. Developers utilize a variety of tools. There&rsquo;s always an unending discussion and argument on which platform is best, as every developer has her own personal preferences. Hopefully this article would give you the information you&rsquo;ll need to make a decision on which you&rsquo;d want to settle for in your next mobile app project.<\/p>"},{"title":"Getting Started with Go - Variables","link":"https:\/\/codehakase.com\/blog\/getting-started-with-go-variables\/","pubDate":"Sun, 19 Nov 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/getting-started-with-go-variables\/","description":"<p>In the previous article - <a href=\"https:\/\/dev.to\/codehakase\/golang---getting-started-16c\">Golang - Getting Started<\/a> on <a href=\"https:\/\/dev.to\">The Practical Dev<\/a>, I wrote an intro to the Go programing language, and how to setup a development environment for your platform.<\/p>\n<p>In this part of the series, we&rsquo;re going to talk about variables in Go, check it out <a href=\"https:\/\/dev.to\/codehakase\/getting-started-with-go---variables-aef\">HERE<\/a><\/p>"},{"title":"Golang - Getting Started, The Practical Dev","link":"https:\/\/codehakase.com\/blog\/golang-getting-started-the-practical-dev\/","pubDate":"Sat, 18 Nov 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/golang-getting-started-the-practical-dev\/","description":"<blockquote>\n<p>\u201cGo will be the server language of the future.\u201d\u200a\u2014\u200aTobias L\u00fctke, Shopify<\/p><\/blockquote>\n<p>Go was first created as an experiment, the goal of its creators was to come up with a language that would resolve bad practices of others while keeping the good things.<\/p>\n<p>Its first release was on March 2012. Go was designed to feel familiar and to stay as simple as possible, the entire language specification fits in just a few pages.<\/p>"},{"title":"Terminal for Beginners!","link":"https:\/\/codehakase.com\/blog\/terminal-for-beginners\/","pubDate":"Sat, 28 Oct 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/terminal-for-beginners\/","description":"<p>Getting into Software Development seem overwhelming (actually it is) these days. One has to go through the hassle of getting familiar with different languages, to organizing codebases, to libraries, frameworks, the list goes on. Every Job description (at least the sane ones), requires additional skills to get the job. Example of such, Version Control (Git or Mecurial), tasks runners, build tools, package managers, etc.<\/p>\n<p>Most of these extra tools are being accessed\/used from a command line interface. The black hacker environment thingy stuff seem frightening kind of, but this article should get you familiar with the terminal interface. For those of us already familiar, after reading this article, you&rsquo;d wished you&rsquo;ve read it before you opened a terminal for the first time.<\/p>"},{"title":"How I Learned Golang","link":"https:\/\/codehakase.com\/blog\/how-i-learned-golang\/","pubDate":"Sat, 02 Sep 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/how-i-learned-golang\/","description":"<p>Go is a relatively new programming language, and nothing makes a developer go crazier than a new programming language, haha! As many new tech inventions, Go was created as an experiment. The goal of its creators was to come up with a language that would resolve bad practices of others while keeping the good things. It was first released in March 2012. Since then Go has attracted many developers from all fields and disciplines.<\/p>"},{"title":"JavaScript Async\/Await 101","link":"https:\/\/codehakase.com\/blog\/javascript-async\/await-101\/","pubDate":"Sat, 12 Aug 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/javascript-async\/await-101\/","description":"<p><img src=\"https:\/\/codehakase.com\/images\/aysnc-await.png\" alt=\"async\/await\" title=\"Async\/await\"><\/p>\n<p>Async and Await has been a blessing to most JavaScript Developers. Even while it was on the <a href=\"https:\/\/github.com\/tc39\/ecma262\/tree\/82bebe057c9fca355cfbfeb36be8e42f18c61e94\">Stage 4 proposal<\/a> for ES6, the feature has been warmtly welcomed.<\/p>\n<p>Node.js now Supports async\/await since its version 7.6.<\/p>\n<h2 id=\"what-is-asyncawait\">What is async\/await?<\/h2>\n<p>If this is your first time seeing\/hearing of this term, here&rsquo;s it in plain English:<\/p>\n<ul>\n<li>Its the newest way\/pattern of writing asychronous code in JavaScript, asides Promises and callbacks.<\/li>\n<li>Async\/await compared to Promises, are non-blocking<\/li>\n<li>Async\/await makes aysnchronous code appear and behave like synchronous code.<\/li>\n<li>Aysnc\/await cannot be used with plain callbacks<\/li>\n<\/ul>\n<h4 id=\"asyncawait-vs-promises-syntax\">Async\/Await Vs Promises (Syntax)<\/h4>\n<p>Lets write a function that returns a Promise, which resolves with some data object. When its called, it logs, and return something:<\/p>"},{"title":"for...in vs for...of Loops in JavaScript","link":"https:\/\/codehakase.com\/blog\/for...in-vs-for...of-loops-in-javascript\/","pubDate":"Mon, 19 Jun 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/for...in-vs-for...of-loops-in-javascript\/","description":"<p><img src=\"https:\/\/user-images.githubusercontent.com\/9336187\/27305938-97169192-553b-11e7-99cb-99396a9593fd.png\" alt=\"for-in-graphics\" title=\"Hakase Labs\"><\/p>\n<p>The <code>for..in<\/code> and <code>for..of<\/code> loops, gives us a clean and concise syntax to iterate on iterable items like arrays, strings, objects, and enumerables. Now the question is where to use which. Here&rsquo;s a little reminder to get you you started.<\/p>\n<h2 id=\"forin\">for..in<\/h2>\n<p>Use this to iterate over the properties of an object:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-javascript\" data-lang=\"javascript\"><span style=\"display:flex;\"><span><span style=\"color:#a90d91\">let<\/span> <span style=\"color:#000\">person<\/span> <span style=\"color:#000\">=<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#000\">name<\/span><span style=\"color:#000\">:<\/span> <span style=\"color:#c41a16\">&#39;Francis&#39;<\/span>,\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#000\">alias<\/span><span style=\"color:#000\">:<\/span> <span style=\"color:#c41a16\">&#39;codehakase&#39;<\/span>,\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#000\">eyeColour<\/span><span style=\"color:#000\">:<\/span> <span style=\"color:#c41a16\">&#39;brown&#39;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>};\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a90d91\">for<\/span>(<span style=\"color:#a90d91\">let<\/span> <span style=\"color:#000\">key<\/span> <span style=\"color:#a90d91\">in<\/span> <span style=\"color:#000\">person<\/span>) {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#000\">console<\/span>.<span style=\"color:#000\">log<\/span>( <span style=\"color:#c41a16\">`<\/span><span style=\"color:#c41a16\">${<\/span><span style=\"color:#000\">key<\/span><span style=\"color:#c41a16\">}<\/span><span style=\"color:#c41a16\"> =&gt; <\/span><span style=\"color:#c41a16\">${<\/span><span style=\"color:#000\">person<\/span>[<span style=\"color:#000\">key<\/span>]<span style=\"color:#c41a16\">}<\/span><span style=\"color:#c41a16\">`<\/span> );\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#177500\">\/\/ name =&gt; Francis\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#177500\">\/\/ alias =&gt; codehakase\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#177500\"><\/span>...\n<\/span><\/span><\/code><\/pre><\/div><p>The <code>for..in<\/code> loop can also be used to iterate over indexed values of a string:<\/p>"},{"title":"Build your first RESTful API with Node.js","link":"https:\/\/codehakase.com\/blog\/build-your-first-restful-api-with-node.js\/","pubDate":"Tue, 13 Jun 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/build-your-first-restful-api-with-node.js\/","description":"<p><img src=\"https:\/\/softwareengineeringdaily.com\/wp-content\/uploads\/2015\/08\/nodejs_logo_green.jpg\" alt=\"Node.js\" title=\"Node.js\"><\/p>\n<p><strong>Node.js<\/strong> is one intimidating JavaScript framework, especially for beginners. This article serves as a quick quide to Node.js, Express.js and MongoDB. We&rsquo;ll building a simple REST API that&rsquo;ll serve as a basic foundation for an application.<\/p>\n<p>For the purpose of this tutorial, you&rsquo;ll be creating the base for a <em>ToDo List<\/em> application (yeah its kinda like the convention to start with ToDo list apps). You&rsquo;ll use all CRUD (create, read, update and delete) actions on the API.<\/p>"},{"title":"Making hakasebot - Twitter Bots 101","link":"https:\/\/codehakase.com\/blog\/making-hakasebot-twitter-bots-101\/","pubDate":"Tue, 30 May 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/making-hakasebot-twitter-bots-101\/","description":"<p>![Bots]({{ site.url }}\/images\/twitter-bots.gif &ldquo;Bots&rdquo;)<\/p>\n<p>This was my first attempt making twitter bots. I made a very simple twitter bot for this blog, check the <a href=\"https:\/\/github.com\/codehakase\/hakasebot\">Source<\/a> and also follow <a href=\"https:\/\/twitter.com\/_hakasebot\">@_hakasebot<\/a>.<\/p>\n<h2 id=\"setting-up\">Setting Up<\/h2>\n<p>The bot was created using the <a href=\"https:\/\/github.com\/ttezel\/twit\">Twit<\/a> package, which is a Twitter API client for Node.js. Twit needs to connect with my twitter account so first I created a new <a href=\"https:\/\/apps.twitter.com\/\">Twitter Application<\/a>. After that, I took note of my application&rsquo;s keys:<\/p>\n<ul>\n<li>Consumer Key<\/li>\n<li>Consumer Secret<\/li>\n<li>Access Token<\/li>\n<li>Access Token Secret<\/li>\n<\/ul>\n<p>You can find these keys on the <strong>Keys and Access Tokens<\/strong> panel in you app&rsquo;s dashboard.<\/p>"},{"title":"JavaScript Objects 101","link":"https:\/\/codehakase.com\/blog\/javascript-objects-101\/","pubDate":"Thu, 25 May 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/javascript-objects-101\/","description":"<p>In JavaScript, most things are objects, from core JavaScript features like strings and arrays to the browser APIs built on top of JavaScript. You can even create your own objects to encapsulate related functions and variables into efficient packages, and act as handy data containers.<\/p>\n<h3 id=\"what-is-an-object\">What Is An Object?<\/h3>\n<p>In JavaScript terms, An Object is a collection of data, which consits of several variables and functions - which are called properties and methods.<\/p>"},{"title":"Introduction to JavaScript Promises","link":"https:\/\/codehakase.com\/blog\/introduction-to-javascript-promises\/","pubDate":"Sun, 21 May 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/introduction-to-javascript-promises\/","description":"<p>JavaScript promises have become a popular way to handle the tangled mess that JavaScript\u2019s asynchronous nature often creates for us.\nSynchronous code is eaiser to follow and debug, async is better for flexibiity. Promises are becomming a big part of the JavaScript world, with awesome APIs implemented with it.<\/p>\n<h2 id=\"what-is-a-promise\">What is a Promise?<\/h2>\n<p>A Promise is a proxy for a value not necessarily known when the promise is created. It allows you to associate handlers with an asynchronous action&rsquo;s eventual success value or failure reason. This lets asynchronous methods return values like synchronous methods: instead of immediately returning the final value, the asynchronous method returns a promise to supply the value at some point in the future. - <strong>Mozilla Developer Network (MDN)<\/strong><\/p>"},{"title":"Object-Oriented PHP - An Easy Approach","link":"https:\/\/codehakase.com\/blog\/object-oriented-php-an-easy-approach\/","pubDate":"Wed, 17 May 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/object-oriented-php-an-easy-approach\/","description":"<p><img src=\"%7B%7Bsite.url%7D%7D\/images\/oop-in-php.png\" alt=\"OOP-PHP\" title=\"Object-Oriented Programming in PHP\"><\/p>\n<p>For some PHP developers, the concept of object-orient programming, seems like a frightening concept. You might have browsed through repos on GitHub or read articles on how to implement a feature in a particular PHP project of yours, and the code is full of complicated syntax. I tell you, the concept of OOP is easy to grasp.<\/p>\n<p><strong>Object-Oriented programming<\/strong> (OOP), is a style of programming which allows us developers and programmers group related tasks or actions into classes to produce effective code. OOP follows the tenet <em>&ldquo;don&rsquo;t repeat yourself (DRY)<\/em>, which are common in procedural programming.<\/p>"},{"title":"Introducing Adonis Js","link":"https:\/\/codehakase.com\/blog\/introducing-adonis-js\/","pubDate":"Tue, 09 May 2017 00:00:00 +0000","guid":"https:\/\/codehakase.com\/blog\/introducing-adonis-js\/","description":"<h2 id=\"tldr\">TL;DR<\/h2>\n<p>AdonisJs is a true MVC Framework for Node.js. It encapsulate all the boring parts of Web programming and offers you a nice &amp; clean API to work with. AdonisJs makes it easy to write web applications with less code. In this article, i will show you how to get started with AdonisJs. Checkout the repo on Github.<\/p>\n<p>Node.js is one of the emerging technologies to write real-time applications using one of your favorite web languages: Javascript. With the ample choices of frameworks to write your first web server, not even a single one offers the desired developer experience. This is where AdonisJs shines.<\/p>"}]}}