Making boring fun - bash and Node to the rescue
August 26, 2021
I rarely get paid to write code these days… or that is people rarely ask me to write code. But since I’m a programmer at heart it is one of the tools in my toolbelt, regardless of what kind of tasks I’m given.
Today I got asked:
Could you please list all Open Source Licenses we are using, and all the dependencies all our code is using.
Considering we have 130+ repositories I was what the scientist refer to as a boring
task.
Let’s make it more fun with code.
I’m gonna wield my bash- and Node-swords to solve this sucker. And I was looking to do some functional programming exercises too - let’s see if we can squeeze all of that in there.
Getting the licenses out of the repos
Each repository has a June 19, 2021 I like to automate repetitive and boring things I do in my daily work. This lead to that me write bash scripts from time to time, but the problem is that I’m a newbie scripter. I’m learning as I go. And the other day I did a cardinal sin in scripting. Not only that - I decided to show the world. Now that is a point to feel ashamed or to learn. I did both. In this post, I will tell you about how I made my I was waiting for the summer part of Salt to start and had an hour over. The weather was amazing and I found a nice tree to sit under. Of course, I flipped up...
June 17, 2021 I’ve been increasingly annoyed with the fact there’s no easy way to add scripts to a Well … until not that is. I give you ScrAdd - the script adder. Let’s say that you are writing a tutorial on how to test next apps. You want the readers just to get to the place where you can start to talk about code. My friend - just I don’t expect this tool to be widely used and spread but I was pretty fun to write it -...
June 13, 2021 I indirectly got a question that I thought would make a good blog post. The question came from the brilliant Emer on this LinkedIn post. That post in itself is a great read on the US Air Force’s thoughts on agile in general - great stuff in there. Anyhow - Emer asked me: Yes! I have read many posts by Allen Holub and our friend Woody Zuil on this. I do struggle though to find a way to practice “true” agility at a large scale. Do you have any good resources on this? and I started to write a response but realized that I needed some more space. This blog post is that response. Hi Emer - I am so happy to hear about your progress and to bounce ideas like this with you. The trick with scaling is that there are no recipes...
May 31, 2021 Oh, man! I’m so happy that I’m still sane. This error was about to drive me crazy. Here’s the back story - we have about 120 repositories with a lot of exercises and tests. This is nigh on impossible to maintain by hand, so we have written scripts to verify the integrity of each repository. Each script is verifying that installation, linting, and testing works as expected. The whole thing is built-in bash scripts and for the most part, works just fine. It’s quite rewarding to have it checked automatically, read about it here But the repositories that have been created with But. Now. I’ve. Found. A. Solution. When...
May 29, 2021 I ran into a stupid problem I created for myself. And then I solved and that made me realize a thing about Next.JS and the server side rendering features of this framework. I wanted to share my failures and solution to the problems I created here. I have a page that is server-side rendered, since I’m the One of the components on the page, reach out and grabs the router: And I then added a click-handler like this: May 24, 2021 It was quite some times since I wrote a programming related blog post - but now the time has come (and my programming output is poured at the Salt protips blog nowadays) I’ve ventured a bit into React Native development and found it very enjoyable, especially in combination with Firebase stuff. But I had a really hard time finding a good example of how to upload files from my phone to the Storage services using Expo. I found this but I didn’t find it easy to follow as all of the code is in one single file. So I took the original code and refactored it a tiny bit for better readability. My code is found here and in the post I’ll walk through some of the things that made me look twice. The setup was plain and simple by...
May 22, 2021 One of the most amazing things about my current job as a teacher and “head master” at Salt is to see amazing people take my material and make something more amazing with it. Or when see people start to venture down avenues that helped me (in this case agile, lean and no estimates) so much. I got a question from Øyvind Ege - a brilliant developer from a class last spring/summer. And with his permission I will here publish his question and my response. I hope you find it useful. Hi Marcus! Øyvind here from the summer 2020 class. I was hoping you could answer some questions I had about Agile! I have the pain and pleasure of being both the full-stack developer and “Product Owner” (I guess, at least I am charged with “estimating” and “writing the specifications”) of a greenfield project....
April 26, 2021 Very early in my agile journey, I stumbled over Behaviour Driven Development (in that exact blog post, in fact - Thanks Dan). And like many, I first thought of it as a more user-friendly way of writing tests. But pretty soon (through the help of Specifcation By Example - Thanks Gojko) I realized that the true power comes from the shared understanding that stakeholders and delivery team can get from writing the specifications together, before we start, as examples/tests using concrete data. I was hooked and Cucumber was my poison. A programming language for requirements. Executable specifications, I mean - come on! This is now 15 years ago and I still am a big fan of this way of working. Hence I was really happy to see that two of my BDD-heroes (Gaspar and Seb) have come together (again) to write about the often...
December 23, 2020 This year has been a very strange one, for most of us. I thought I’d share a little Christmas Greeting. For me personally, I’ve gone through one of the big personal crisis of my life that led to a sudden, and deep, fatigue syndrome. I am better but it takes longer that than I wanted and I still am fighting a lot of different symptoms of the sickness. But there is hope. For all of us there is hope - we can do this. We can get through the pandemic, drepression and fear. I’m sure that we will make it - and I’m sure that we will come out stronger, wiser and probably learned a lot. Before dragging y’all down into a hole of dispair I better get those Christmas Greetings out of the way, right?package.json
file that contains a When I learned a safety lesson - and did a little bit better
curl
-script a little better and a lot safer, but using an old way that’s been in curl
for ages.The background
Introducing ScrAdd - the script adder
package.json
file programmatically. It always messes up my lovely scripts for tutorial setups and other use cases. Very frustrating.scradd
in that command and take the rest of the day off!npx create-next-app demo cd demo npx scradd . test "mocha . -R dot -w" npm i -D mocha
Some thoughts on scaled agile
Run react-script tests without watch
create-react-app
have caused problems from day one. They work just fine when we use them normally, but in the script, it’s flaky at best and just hangs at worst.More problem
React-Scripts and Jest
Next.JS Error: No router instance found
getServerSideProps
.import { useRouter } from 'next/router'; const Header = () => { const router = useRouter(); }
<div onClick={router.push('/')}> ...stuff...
Uploading pictures to Firebase in React Native
Setup
Some questions about estimation and plannning
The question
Formulation - the crucial (often missed) step of BDD
Christmas greeting