DEV Community

willsmart profile picture

willsmart

Coding since 11yo, that makes it over 30 years now ~~~ Have a PhD in Comp Sci ~~~ Love to go on bike tours ~~~ I try to stay as generalist as I can in this crazy wide place coding is at now.

Location NZ Joined Joined on  Personal website https://willsm.art github website

Education

to post-doc

All 117 comments

Facebook is down, discuss...

It probably has nothing to do with a rogue dependency, but th...

Explain Callback Function In JavaScript Like You Are 5 Years Old

There's a book mail-order company with pretty old systems. Yo...

Are you giving the proper sense to React.Fragment?

I'm confused 🤔 Do you mean to say you're a coder but don't do...

Are you a good developer already?

Also: a good developer has internalized that it's not about c...

JavaScript Interview Question #18: What's the sum of two booleans in JavaScript?

A hell of a lot cleaner, in theory a bit slower too. filter a...

React Clean Code - Simple ways to write better and cleaner code

Great tips! Have you used the wrong code for the first two co...

JavaScript Interview Question #18: What's the sum of two booleans in JavaScript?

Or count things cleanly... isEven = v => !(v & 1) ...

JavaScript Interview Question #17: Sum of Two Empty Arrays

Fun fact: any combo of any number of [], 0, "", whitespace (m...

TypeScript vs JavaScript

My 2c is that Javascript has a wide array of traps for inexpe...

Advent of Code 2020 Solution Megathread - Day 6: Custom Customs

Python impl today. Prob not great python but works. print(...

Advent of Code 2020 Solution Megathread - Day 5: Binary Boarding

Here's my C implementation. Kind of glad it was a straightfor...

Reusable Code with "this" Keyword

This kind of encapsulation is a great idea, but I strongly su...

Advent of Code 2020 Solution Megathread - Day 4: Passport Processing

Plain forgot to break out of the comfort zone and use somethi...

Advent of Code 2020 Solution Megathread - Day 1: Report Repair

I'm liking Ryan's idea of using this to practice new language...

Advent of Code 2020 Solution Megathread - Day 1: Report Repair

Yep, this'll be another year fighting the urge to pre-optimis...

Daily Challenge #308 - Wave Sort

A little one version in pretty damn cryptic but possibly spee...

Releasing my personal project

Works really nicely so far, well done! Just three bits of fee...

Releasing my personal project

Love it, good luck!

Daily Challenge #306 - Largest Possible Product

A KISS version in typescript... function greatestProductOf...

Daily Challenge #304 - Consecutive Letters

You're right, space is part of the equation too. It's all abo...

Daily Challenge #304 - Consecutive Letters

It's always nice to avoid a second iteration over elements if...

Daily Challenge #296 - Years to Centuries

Here's a typescript implementation, and a ✨verbose-and-pretty...

Daily Challenge #294 - Sum and GCD Practice

Well spotted!

Daily Challenge #293 - Name the Operations

Just a quicky in JS ops = [ { name: 'subtraction', op: (...

Daily Challenge #288 - Maze Runner

One with full typing info in typescript... // Input type Ma...

Daily Challenge #287 - 16+18=214

Thanks, that's a fair point. Here's the tweaked code: funct...

Daily Challenge #287 - 16+18=214

A quickie in Typescript Each digit is enumerated in turn by s...

Daily Challenge #286 - Reverse It Quickly!

Nice solution! a=>a.map(a.pop,a) would also work sin...

What is a specific recurring challenge you have with CSS?

It ends up being the messy part of the project. Even using SA...

Capitalize the first letter of every word

Thanks Mehul

Capitalize the first letter of every word

Hey thanks for that, that's awesome! One nice thing about th...

Capitalize the first letter of every word

Case conversion can get a bit tricky with edge cases, like do...

Weird behaviors of javascript: Primitive Types and Reference Types

I'm signing off the thread btw

Weird behaviors of javascript: Primitive Types and Reference Types

A bit of constructive editing... I'm glad we can all agree ...

Weird behaviors of javascript: Primitive Types and Reference Types

JS always passes function args by value. const a = somethin...

Daily Challenge #282 - Car License Plate Calculator

In JS with toString and a custom radix ended up being pretty ...

What design tools do you use?

Love it. Pen and paper is still what feels best for me. The t...

I have a joke about X but ...

I have one that's about recursion

I have a joke about X but ...

... in fact, I'm not sure you'd get it anyway

Daily Challenge #29 - Xs and Os

It's working for me in chrome just now. Try wrapping the outp...

Daily Challenge #270 - Fix String Case

Here's a C implementation that does a pretty good job at bein...

Solving "Spinal Tap Case" / freeCodeCamp Algorithm Challenges

Well, it's a trade-off. On the one hand "AAAA" is the word "A...

Solving "Spinal Tap Case" / freeCodeCamp Algorithm Challenges

No worries, hope it helps! BTW I've updated the main line of...

Solving "Spinal Tap Case" / freeCodeCamp Algorithm Challenges

Nice one! This can be made a little cleaner though by using z...

Daily Challenge #266 - Who Likes It?

This'd be a good use for template literals. Here's a quicky i...

How do you deal with null vs undefined?

I just use undefined everywhere, and ruthlessly convert nulls...

JavaScript: How to Remove Duplicate Values from Arrays

A similar function using Set is function withoutDuplicates(...

Daily Challenge #264 - Digital Root

Here's my take on the modulus one, keeping with the nsfw JS s...

Daily Challenge #264 - Digital Root

Anytime there's this sort of array summarizing is a good time...

Daily Challenge #260 - Subtract the Sum

A quick JS one: First up, set up the base fruit mapping by s...

Daily Challenge #254 - The Vowel Code

Cheers

Daily Challenge #254 - The Vowel Code

Let's do it in JS using neat little generic HOF... const ...

Daily Challenge #25 - Double Cola

Here's a bit of explanation and a rewrite to make the code bl...

JavaScript: Double Not Operator?

The bitwise NOT operator can be used as a poor-mans integer c...

Daily Challenge #190 - capitalizeFirstLast

Thanks!

Daily Challenge #190 - capitalizeFirstLast

An easy option is to start off by lowercasing the whole thi...

How would you handle a conversation with someone who thinks "respecting an opinion" means "agreeing with it"?

IMO your personal view of what is correct, true, best-pract...

JS Array Manipulation Quirks

As a rule I see charAt/charCodeAt/length for strings as use...

Git Workflow: Should the history of commits show the real time of your work?

Like the topic! I just see commits a little units of work,...

4 Dangerous Problems in JavaScript Easily Solved by The Builder Design Pattern

Thanks for a great post! It's a great discussion of why th...

✨ 5 damn easiest soft skills💡 needed to become a 10X🔥...Yes...10X🔥 Software Engineer ✔️

Totally agree! The senior devs I've worked with tend to end...

Daily Challenge #123 - Curry me Softly

A simple impl in Typescript... function doCurrishSortOfTh...

Classes Rock

I’ve got a useful regex substitution for situations like th...

How do you prioritize learning new things?

TBH I find turning the telescope 10x harder than just looki...

Daily Challenge #101 - Parentheses Generator

This is another case where dynamic programming is useful. R...

13 useful JavaScript array tips and tricks you should know

Tip 10 has an off-by-one error going on: there's no need to a...

Daily Challenge #95 - CamelCase Method

I agree with SavagePixie. replace is the way to go if you'r...

Daily Challenge #90 - One Step at a Time

So an easy "greedy" implementation isn't going to work for...

Daily Challenge #89 - Extract domain name from URL

One in JS hostName is based on a quick reading of the spec...

Daily Challenge #84 - Third Angle of a Triangle

BTW the challenge on Kata only tests for valid triangles, ...

Daily Challenge #84 - Third Angle of a Triangle

Keeping it simple in bash function thirdAngle { echo $(...

Git Workflow: How much change is too much change for one commit for you?

The first line of my commits describes what the change will...

Daily Challenge #80 - Longest Vowel Change

The new JS function matchAll is going to be really useful. ...

Daily Challenge #79 - Connect Four

One in TypeScript that tracks "groups" of connected pieces ...

5 Great Git CLI Shortcuts

A nice one is alias gdammit='git --amend --no-edit' F...

Daily Challenge #77 - Bird Mountain

A TypeScript version using reduces and maps to avoid too mu...

Daily Challenge #75 - Set Alarm

How about prolog? A file with one fact should do it... s...

Daily Challenge #74 - Free Pizza

Here's one in TypeScript My preferred way of passing bags ...

Brag Post

Awesome work! I'm finding it an easier interface than codep...

Daily Challenge #63- Two Sum

reduce is good for this one. Here's a JS quickie with O(n) ...

Daily Challenge #60 - Find the Missing Letter

A quicky using reduce in JS First up it converts the array...

Daily Challenge #57 - BMI Calculator

Fair point Craig, in this case it turns out to be a bunch s...

Daily Challenge #57 - BMI Calculator

Let's say you need to run this a few billion times times, t...

Debugging Challenge: The cursed default clause

Love it. That's really counterintuitive but makes sense. A...

What is the oddest JavaScript behavior?

Fair enough. I didn't mean insane in the sense of completel...

What is the oddest JavaScript behavior?

But at least ruby is rigorously consistent OO like that. ...

What is the oddest JavaScript behavior?

It makes sense why, but I think it's a pity that 0 === -0...

What is the oddest JavaScript behavior?

yep, a good check for an actual object is thing &&amp...

Give Your App Slick Name with namae.dev

That's awesome! Bookmarked

Daily Challenge #47 - Alphabets

A JS one-liner alphaPosition = s => [...s.toLowerCase(...

Daily Challenge #46 - ???

Well, since we're doing cmd things... read s; echo "${s//...

Daily Challenge #44 - Mexican Wave

A little JS impl using a regex and matchAll (avail in recen...

Daily Challenge #43 - Boardgame Fight Resolver

Sure thing. It's a "don't look behind the curtain" kind of ...

Daily Challenge #43 - Boardgame Fight Resolver

I'm surprised no-one has used the age old xor-the-second-bi...

Daily Challenge #41 - Greed is Good

JS implementation keeping the rules as data function scor...

Daily Challenge #35 - Find the Outlier

A javascript one that has pretty reasonable complexity fu...

What is quantum computing?

If you learn best by doing IBM has an interface to an actua...

Daily Challenge #29 - Xs and Os

How about a reduce to keep it in one loop? (JS) XO = str =...

Daily Challenge #27 - Unlucky Days

Javascript shorty matchingDayCount = (year, dayOfMonth=13...

Daily Challenge #26 - Ranking Position

Just a short one in Javascript Edit: somehow I hadn't not...

Daily Challenge #25 - Double Cola

Completely untested one written on a phone in js. I’m guessin...

Daily Challenge #24 - Shortest Step

JS using a bit of bitwise math // Wow,.. fancy :| step ...

Daily Challenge #21 - Human Readable Time

A functional style one in JS that was fun 😋

Daily Challenge #19 - Turn numbers into words

Here's a JS one that goes into the gazillions 🤔

Daily Challenge #15 - Stop gninnipS My sdroW!

Nice one! If you replace the trim() with a substring(1) the...

Daily Challenge #15 - Stop gninnipS My sdroW!

And one that modifies a string inplace using C #include ...

Daily Challenge #15 - Stop gninnipS My sdroW!

JS quickie theString => theString.split(' ').map( w...

There are 10 types of people...

There are 10 people in the world, 10% of them understand nu...

Daily Challenge #3 - Vowel Counter

JS one that's probably pretty speedy vowelCount = string...

Daily Challenge #2 - String Diamond

JS Now with contrast, invertability, custom strings and ot...

Daily Challenge #1 - String Peeler

Seat of your pants GNU C printf(“String: %s”, s); printf...

Creating Pixel Art with CSS

Such a cool technique! Great post. I noticed you're drawin...

The shortest way to conditional insert properties into an object literal

That's awesome. Thanks for posting. I didn't know that the ...

loading...