“...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 InPay...”

Rob Lacey (contact@robl.me)
Senior Software Engineer, Brighton, UK

OnePassword account reset

I appear to have forgotten my OnePassword password again, and having reset everything I couldn’t work out how to force the deletion of the old credentials that clearly I wasn’t able to login with. I went round and round, I could even see a list of accounts but with no way to reset them. Turns out it’s rather expertly hidden under Help > Troubleshooing.

Not exactly where I was expecting but hey hey.

What language is this?

Just because I am incredibly mean. I put together this little Quiz Round.

Question 1

You’re basic.

05 REM ON VALUE GOTO LINE1,LINE2,LINE3.. demo
10 TEXT : HOME
20 INPUT "Enter number 1,2 or 3: ";A
30 IF NOT(A=1 OR A=2 OR A=3) GOTO 10
40 ON A GOTO 100,200,300

100 PRINT "LINE 100" : GOTO 500
200 PRINT "LINE 200" : GOTO 500
300 PRINT "LINE 300" : GOTO 500

500 END

.
.
.
.
.

Question 2

I’ll give you anything you want, but I’ll always get my take.

import re
for test_string in ['555-1212', 'ILL-EGAL']:
    if re.match(r'^\d{3}-\d{4}$', test_string):
        print (test_string, 'is a valid registration for a snake')
    else:
        print (test_string, 'rejected')

.
.
.
.
.

Question 3

Hopefully this one doesn’t fuck with your brain.

--<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+.

.
.
.
.
.

Question 4

Wake me up.

<script>
var x = 5;
var y = 6;
var z = x + y;
document.getElementById("coffee").innerHTML =
"The value of z is: " + z;
</script>

.

.
.
.
.
.

Question 5

Drink this, it will make you feel better.

true = String.ends_with?("Youth.", ".")

# True if any of list values match:
true  = String.ends_with?("Youth.", [".","?"])
false = String.ends_with?("      !", [".","?"])

.
.
.
.
.

Question 6

I like to pummel it until it’s proper mashed up.

#!/bin/bash

string1="Linux"
string2="Hint"
echo "$string1$string2"
string3=$string1+$string2
string3+=" is a good place to fight"
echo $string3

.
.
.
.
.

Question 7

Well it’s been 40 years of silence, it’s been 40 years of pain.

class Cat
  def can_claw_your_face_up?
    true # dat
  end
  
  def empathise_with_your_existential_crisis?
    !really?
  end

  private

  def really?
    true
  end
end

.
.
.
.
.

Question 8

A, B, D, E, F, G, H, I , J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z

#include <stdio.h>
int main() {
   int year;
   printf("Enter a year: ");
   scanf("%d", &year);

   // leap year if perfectly visible by 400
   if (year % 400 == 0) {
      printf("%d is a leap year.", year);
   }
   // not a leap year if visible by 100
   // but not divisible by 400
   else if (year % 100 == 0) {
      printf("%d is not a leap year.", year);
   }
   // leap year if not divisible by 100
   // but divisible by 4
   else if (year % 4 == 0) {
      printf("%d is a leap year.", year);
   }
   // all other years are not leap year
   else {
      printf("%d is not a leap year.", year);
   }

   return 0;
}

.
.
.
.
.

Question 9.

Queer eye for the the interwebs.

.cascading {
  border: 1px solid blue
}
.style {
  height: 100px
}
.sheets {
  border-radius: 5px
}

.
.
.
.
.

Question 10

I’ve come to see the Oracle, I need answers.

procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
    Image1.Picture.LoadFromFile(OpenDialog1.FileName);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Image2.Canvas.CopyRect(
    Rect(0,0,Image2.Width,Image2.Height),
    Image1.Canvas,
    Rect(
      0,
      0,
      Image1.Picture.Width-50,
      Image1.Picture.Height-50));
end;

.
.
.
.
.

No more RI / RDoc

In 10 years I have never once used installed RI or RDoc documentation, so let’s not bother installing it.

Adding this to ~/.gemrc will mean it is never built

gem: --no-document

And then nuke all currently installed documentation.

rm -rf `gem env gemdir`/doc

Boom.

Installing Raspberry Pi Zero W

Download Etcher

Install Image on
https://www.balena.io/etcher/

Boot It

login: pi
password: raspsberry

Enable SSH

Get pissed off when you can’t SSH to it.

find that thing in that gem what you need

I know it’s in Rails somewhere, maybe. But where the hell is it and how do I call it. If you want to do a quick grep of your entire bundled gems paths. You can….

bundle show --paths | xargs grep -r eager_load

I’m trying to find the way to run eager_load so that everything in my application that isn’t loaded in development doesn’t just fart and fall over in deploy.

Turns out it was this I wanted for Rails 6

Zeitwerk::Loader.eager_load_all

Watch this movie or don't

Upstream Color is a delight.

Obviously if someone suggest you eat a worm for fun, you might want to say no.

Paladins of the West Kingdom - Ten Minute Teach

We did some video, editing skills might need slightly more than 12 seconds fade transition. But hey.

Buy this game, it’s incredible.

It's a kind of magic...

I am have been rather privileged to work on some cool projects, and this was a real pleasure. Big Blind Media are an online magic store and their focus in the past has very much been on physical tricks and DVDs of how to reproduce those tricks as a performance. But with physical media going the way of the Dodo it was time to start pushing more towards on-demand media and that meant building a download platform to run alongside their existing Shopify store.

The new downloads portal is up and running and I know Owen is plugging away adding a plethora of content ready to release, and not least with Adjective from Liam Montier

So if you’re wondering what the hell to do during your next Zoom chat this lockdown Bank Holiday Weekend, then maybe a bit of magic is in order.

Offloading database and multi-database connections

Today I wanted to look at offloading a single logging table from our application into a different database. I am going to forget how to GRANT MySQL Permission for a entire netmask, so I’ll just remind myself.

GRANT ALL ON production_logging TO dave@'192.168.0.0/255.255.0.0';

As you might know the way you override the database connection for a particular model is to define specifically.

class LogEntry < ApplicationRecord
  establish_connection { username: 'dave', password: 'arnold', host: '192.168.1.16' }
end

It’s doesn’t feel particularly configurable. I could do something like…

class LogEntry < ApplicationRecord
  establish_connection Settings.get(:dennis)
end

But I want to extract this some more. Partly for fun and partly because I might want to make the settings dependent of different environments. So, today inspired by the Virtus syntax configuration we have the following.

class LogEntry < ApplicationRecord
  include DatabaseConnection[:dennis]
end

And it’s implementation.

module DatabaseConnection
  def self.[](settings)
    Module.new do
      extend ActiveSupport::Concern
      included do
        establish_connection Settings.get(settings)
      end
    end
  end
end

No an include can’t take an argument, but an include accepts a Module and that Module can be defined here or defined the result of any other method method.

Animal Crossing Custom Designs

So Kat and I were playing around with making Custom Designs for her Animal Crossing Island, basically you can make a 32px x 32px image and import it via a QR code. You can build the image in any graphics package, we used Photoshop to resize her I Play Red logo to 32px x 32px and import it with the Animal Crossing Pattern Tool

Then you scan it via the Nintendo Switch Online App and Download from your in game Animal Crossing mobile. Sadly we had to do this one by one with multiple scans but this was a fun exercise.