“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust.
I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it
Currently working for GenieBelt who are based in Copenhagen, Denmark ...”
This year has been a weird one. And life takes a turn.
At the end of last year, after 4 years, I decided to move on from SARD JV Limited they are lovely people and the team are great and we still talk but for varying personal reasons, it could not continue and I set out to seek my fortune elsewhere.
I landed with Builder.ai in January of this year and realised pretty quickly that the role I had taken was not for me. I’m not afraid of meetings, planning, mentoring, code reviews, far from it. But when I realised that I wasn’t writing any code myself that became a problem. With SARD JV I was in the heart of everything, guiding the development of the application and introducing new ways of restructuring code, adding in performance gains the whole package, I had code coming out of my ears and I was waking up thinking about code. Without being in the thick of it I was in a place where I wasn’t happy. This is the first time I felt like I’d made the wrong choice and it was wrong to continue for myself and for Builder.ai so I made a quick exit.
In April I joined Juniper Education and have for the past six months been working as a Senior Developer in an exceptional team on a pretty complex Assessment tracking system for UK schools. Plenty of performance problems to tackle and interesting UIs. We were on the verge of launching the product in the coming months. Sadly, however, the business has decided not to continue with Ruby. I mean I think Ruby is pretty great, but… that’s not our decision. That means a medium size team of developers were released in the wild on Tuesday of this week.
If only there was a startup that needed 5 to 10 developers to that were already comfortable working with one another to start on a new product. Wishful thinking I know.
So for now I’m on the hunt for work myself. I have all of my possessions wrapped in a hankerchief on the end of a stick and I am off to the end of our driveway to seek my fortune. That might be a lie.
So here goes “…I’m a seasoned but not salty Senior Software Engineer from Brighton, UK who’s been working with Ruby/Rails (remotely) for the past 15 years. I’m looking for a fully remote role that is hands-on focusing on code rather than people management although I love working with other developers and wish to continue code review and mentoring. I want to make a positive impact on the team I land in and inject my experience in a new project/adventure…”.
If you have a quest that needs a Tank, I’m available and ready to work with you. Feel free to take a look at my CV and any feedback positive or negative is very welcome.
It appears to be the wrong time of year to be looking for a new Ruby/Rails gig. But unfortunately my brain isn't ready to hibernate for the Winter. So if you have hard problems, horrible upgrades or just need a reliable, competent, conscientious Senior Ruby Dev... #ruby#railspic.twitter.com/gKEJSfT5J1
Syntax Highlighting is important, it just makes code all warm and fluffy and more engaging. I currently use HighlightJS in my Rails 7 app.
./bin/importmap pin highlightjs
bash
Which adds the following to `config/importmap.rb`
pin "highlightjs", to: "https://ga.jspm.io/npm:highlight.js@11.4.0/es/index.js"
ruby
Over the years I have used a number of different ways to organise my code examples in blog posts. They are a mixture of RedCloth and HTML and I used to used to use CodeRay and then SyntaxHighlighter to render code blocks nicely.
<x-source:ruby>
class Cat; end
</x-source>
but eventually settled on pre > code and HighlightJS
<pre>
<code>
class Rabbit; end
</code>
</pre>
html
As an aside I never updated the old blog posts but created a renderer to update the body of the posts to comply to the new format, and even ensure that I could embed my pre > code html in examples too by escaping the contents of every pre > code element.
# frozen_string_literal: true
class Content
def initialize(string)
@string = string
end
def render
::Haml::Helpers.preserve(segments.join('')).html_safe
end
private
def string
@string.gsub(/<source(:[a-z]+)?>/, '<pre><code>')
.gsub(%r{</code></pre>}, '</code></pre>')
.gsub(%r{<code>([\s])+}, "<code data-controller='highlight'>")
end
def segments
string.split(/(<pre><code>.*?<\/code><\/pre>)/m).map do |s|
if s =~ /<pre><code>.*?<\/code><\/pre>/m
s.gsub(/<pre><code>(.*)?<\/code><\/pre>/m) { "<pre><code data-controller='highlight'>#{CGI::escapeHTML($1)}</code></pre>" }
else
RedCloth.new(s).to_html
end
end
end
end
ruby
I could then use just a turbo:load EventListener to apply the highlight the code blocks.
app/javascript/application.js
However, this doesn’t work with Turbo-Frame, the `turbo:load` callback is only run on full page loads and I want to use them in Turbo-Frame(s). I am sure there is another callback I could run but honestly I’d prefer to use a Stimulus Controller and know that it will always trigger when the DOM changes and my code block is added to the DOM.
import { Controller } from "@hotwired/stimulus"
import HighlightJS from "highlightjs"
export default class extends Controller {
connect() {
HighlightJS.highlightElement(this.element)
}
}
javascript
With code blocks looking like
<pre>
<code data-controller="highlight">
class Rabbit; end
</code>
</pre>
html
This seemed to work in development but failed in production. AS it turns out I was caching the content of every blog post, so it wouldn’t need to re-render every
Rails.cache.clear
ruby
For bonus points I’ve added support for triple back-tick ```language delimited blocks for code.
# frozen_string_literal: true
class Content
def initialize(string)
@string = string
end
def render
::Haml::Helpers.preserve(segments.join('')).html_safe
# rescue => e
# 'BROKEN'
end
private
def string
@string.gsub(/<source(:[a-z]+)?>/, '<pre><code>')
.gsub(%r{</code></pre>}, '</code></pre>')
end
def segments
rewritten = string.split(/(
Most people’s first project in a language / framework is a simple ToDo example or a blog. I guess I’m in the same situation. However, my first Ruby project was a blog and I’ve been dumping code snippets, findings and moans on that for 10 years now. So my first Elixir project should really be to port my Rails blog to Phoenix. Here’s some things I learned along the way.
I get the distinct impression that this book, along with particular circumstances may have changed my life.
I was working as a Network / Systems Administrator for whatever particular system was broken that day at that time, trying to migrate every last website off old hardware, and trying not to spend my day desperately trying to build something meaningful in PHP (while doing the normal day job stuff) and generally being bored out of my skull at a job I had loved for years. It was partly being bought out, moving into a data centre and then in almost cubicles where we hardly spoke to colleagues we’d previously spent all day chatting and joking with for make benefit glorious internet. The love had left the building.
So then I heard about Ruby, Rails and then met John well I met him at a job interview that I was going for …erm with him. To do those things I was bored out of my skull doing but still to me it was easy and I could learn Ruby on the job for make benefit glorious brain, career advancement.
I bought this book for significantly more than the £3 it goes for on eBay now. I moaned about how the Order object was marshalled in the Session rather than store the order_id and look it up. But hey. It opened up my eyes to some kind of framework and structure rather than bumbling through making a PHP file per page on my site and boom.
Some 15 years later I am still writing Ruby and money appears in my account every month as a result of this.
Hi, You’re receiving this email because your Gigalixir app, iplay-red, is inactive and is scheduled for scale down to 0 replicas in 7 days. We define an inactive app as one that has not been deployed for over 30 days as opposed to one that does not have any network traffic. We do this so that we never have to put apps to sleep. If you want to keep your app running, just deploy or upgrade within the next 7 days.
Ok, better add some more features. Thanks for the heads up Giggles
Before I started with Ruby, I had worked with Perl, PHP, Python, and BASIC (ok, back before I was 10). Ruby has stuck and has been my goto for everything. I feel like this has left me rather stuck and lacking any kind of contrast to other solutions, problem solving, perspective on how to create effective software. So my list of things to look at over the course of the rest of my life
--
- Ruby
- Go
- Rust
- Python
- Elixir
- Erlang
- Crystal
- Haskell
- Elm
- C++ (Unreal Engine)
With any luck exposure to all of this will make my brain explode in interesting artistic patterns.
Ok, I threw this up about a week ago. Still I’ve managed to deploy my first Phoenix application to Gigalixir. It’s attempting to be a rather splendid, better than the YouTube UI for I Play Red ’s YouTube Channel …which will allow Kat the ability to publish her videos, which are then synced here but at the same time label them with the game they are for. Which allows for better searching, SEO, OpenGraph, and generally syndicating all over the shop.
Plus I have a project to build something that needs to work and we can measure success on nicely. Not like this blog where the only person that really needs to read it is me :)
Ruby is somewhat versatile at times. Suppose you want to define a class dynamically, and I do….
class Thing; end
Ok, that’s not dynamic
# still not dynamic but getting there.
def define_a_class
Thing = Class.new
end
# ok then I see
def define_a_class(name)
Object.const_set(name, Class.new)
end
define_a_class('Thing')
=> Thing
This is great but what if you wanted to define a class within a module
define_a_class('Nigel::Thing')
NameError: wrong constant name Nigel::Thing
from (pry):19:in `const_set'
Oh. That sucks. What you’re actually trying to do here is
Just trying to boot my application after a little time away from the project. Just wondering if my my latest brew upgrade broken something here too. Node and MongoDB went foom too on the last upgrade.
Robs-MBP:i_play_red_umbrella rl$ iex -S mix
Erlang/OTP 25 [erts-13.0.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns] [dtrace]
11:17:06.689 [error] beam/beam_load.c(86): Error loading module 'Elixir.Code.Formatter':
lambda already defined for label 744. To fix this, please recompile this module with an OTP 25 compiler.
11:17:06.689 [error] Loading of /Users/rl/.asdf/installs/elixir/1.13.1/bin/../lib/elixir/ebin/Elixir.Code.Formatter.beam failed: :badfile
** (UndefinedFunctionError) function Code.Formatter.locals_without_parens/0 is undefined (module Code.Formatter is not available)
(elixir 1.13.1) Code.Formatter.locals_without_parens()
(elixir 1.13.1) lib/code/normalizer.ex:22: Code.Normalizer.normalize/2
(elixir 1.13.1) lib/code.ex:1107: Code.quoted_to_algebra/2
(elixir 1.13.1) lib/macro.ex:948: Macro.to_string/1
Ok so it’s using OTP 25 but it’s compiled with OTP 22?