Sign up

layer|twenty|two

Not verified No WebSub updates No webmention support Not yet validated

Functional Web Applications

Managing Editor
Piotr Usewicz
Webmaster
Piotr Usewicz
Generator
Jekyll v4.4.1
Public lists
I ♥ RSS
Fetched

layer|twenty|two
• Piotr Usewicz

Swift and Cute Framework: Setting up a project with CMake

Cute Framework is a simple, yet powerful C/C++ framework for building 2D games using the modern GPU pipeline. While C or C++ is fine, Swift is a modern language that many developers prefer for its safety and expressiveness. In this post, we will explore how to set up a project using Cute Framework with CMake, enabling you to write your game logic in Swift while leveraging the performance of C/C...

layer|twenty|two
• Piotr Usewicz

Configure MacVim to Automatically Switch Colorschemes Based on macOS Dark or Light Theme

Introduction MacVim is a powerful text editor that can be customized to suit your preferences. One of the ways to enhance your MacVim experience is by configuring it to change its colorscheme based on the macOS dark or light theme. In this blog post, I will guide you through the process of setting up MacVim to automatically switch colorschemes depending on your macOS theme. Code for your .vimrc...

layer|twenty|two
• Piotr Usewicz

My Journey From QWERTY to Norman and Back: A Vim User’s Tale

As a programmer and avid typist, I’m constantly on the lookout for ways to improve my typing experience. In my quest for a more efficient keyboard layout, I decided to embark on a journey to switch from the traditional QWERTY layout to the Norman layout, only to find myself back at QWERTY due to some unforeseen difficulties with Vim. In this blog post, I’ll share my experiences, the pros and co...

layer|twenty|two
• Piotr Usewicz

Fish Shell abbreviations–what are they and how to configure them?

Fish Shell abbreviations are a fantastic way to configure what is commonly known as aliases for your day-to-day use. The difference between an alias and an abbreviation is that it expands to the entire command whenever the abbreviation gets triggered. Traditionally, aliases are shown as they are typed in the shell’s history. The expansion is an excellent benefit of using abbreviations. One can ...

layer|twenty|two
• Piotr Usewicz

Keep your Heroku Ruby version and .ruby-version synchronised

Not everybody realizes that the Gemfile is just another Ruby script that can contain arbitrary Ruby code. Sure, it does understand some DSL such as gem, ruby or source but we can use it to make our lives a bit easier if we use Heroku to deploy our app and rbenv or rvm to manage Ruby version locally. This trick I use for my Heroku applications allows me to upgrade the Ruby version used quickly. ...

layer|twenty|two
• Piotr Usewicz

TIL: Use Rails travel functions instead of timecop or time-warp

If you were using timecop or time-warp gems like me before, you will be happy to hear that Ruby on Rails provides its own travel and travel_to methods that allow you move in time and test time sensitive methods. It’s great to see that you don’t need an external gem for this! test 'creates a post in the past' do travel_to(5.days.ago) do @post = Post.create end assert_equal 5.days.ago, @post.crea...

layer|twenty|two
• Piotr Usewicz

Standardising coding style across the team with RuboCop

As some of you realise, there are times when you open an old file containing code and you think “WTF”. It’s also very likely that it is a file that you have created months or even years ago, and completely forgot about it. Some of the issues with code and people are that people have opinions. Some are more vocal than others, some are more passionate; some are plain silly. And it can be a pain, ...

layer|twenty|two
• Piotr Usewicz

How to create a website spider

Creating a spider that generates a list of URLs for a given domain is very easy to do. Spider simply visits each page in a domain, finds all the links and visits those. With help from a gem called Spidr we can achieve that with few lines of code. require 'spidr' urls = [] Spidr.site('http://www.layer22.com/') do |spider| spider.every_url do |url| urls << url end end Fetching page content ...

layer|twenty|two
• Piotr Usewicz

Spring-load your Rails development environment to speed it up

There is a wide selection of tools that allow you to pre-load your Rails development environment to make it faster. We have Zeus, Spork or Spin. All of them are great and help you work with your development environment faster, but there is a new contestant—Spring by Jon Leighton. What sets it apart from others is fantastic integration with Rails—in fact, it will be a default with all new Rails ...

layer|twenty|two
• Piotr Usewicz

Automatically bundle controller-specific assets

It’s very convenient to be able to automatically bundle some of the assets in a separate file eg. when you have a lot of controller/resource specific CSS or JavaScript. Let’s say we are writing a blog, and we have two controllers—one for posts and one for comments. We would also like to separate the stylesheets for them, because, well, they are huge and only apply to either posts or comments. A...