Today’s problem was especially difficult. Not because the problem was hard, the problem is a no-brainer. No, it was difficult because I decided to only work in Emacs for these challenges.
I do not know the first thing about emacs.
To make things even more interesting I also decided I would not be using the mouse while I’m in emacs. It was a very interesting experience.
You are given a string with words and spaces. Turn it into a Hashtag.
Example
“Hello world” => #HelloWord
So I guess the question is why on earth would I try out emacs? I mean I use Webstorm for work so what’s wrong with continuing with that? Am I trying to be a hipster? Am I being contrary just to be contrary? No, I actually have reasons, they aren’t good reasons but reasons non the less;
People have been waging the Editor War since before I started programming. I’ve mostly kept to the sidelines and focused on my code but I think it’s about time I see for myself just how much more productive I can be. So for the next couple of months, I’m going to slowly start doing more and more stuff in emacs.
Another question would be why did I not start with vim? That’s easy, the coin landed heads.
On yeah, this is supposed to be a code challenge thing right?
Let’s not overthink it. Generating hashtags can be brute-forced. So let’s do that.
function hashtag (str) {
if (str.trim() === ''){
return false
}
const hash = str.split(/\s+/).reduce((output, word) =>
(output + word[0].toUpperCase() + word.slice(1)), '#')
if(hash.length > 140){
return false
}
return hash
}
Code language: JavaScript (javascript)
Trim white space, reduce while capitalizing, and Bob’s your uncle.
So what editor are you using? Is this Editor War still a thing? Something something code challenge, something something, hit me up on Twitter, @phoexer, happy coding.
Today I am working on a summation problem made to look like building a tower out of cubic bricks. It’s fun to brute force sometimes.
Coming back to Rust code after a bit of a hiatus with a simple problem… The Two-sum problem. Finding numbers in an array. Yay, fun.
King Pinn: I Salute You. I’m driving halfway across the country and this song is on repeat. Rest in Peace Tonderai Makoni. You were awesome.
After a few weeks off I’m back to business. This is just an update post detailing plans for the rest of the year.
At last we finally have the great reveal, our mystery project was implementing RSA encryption in rust.