Projects
-
Webpack, Explained by Someone Who Just Learned What It Is
Image by digital designer from Pixabay
What is webpack?
At a recent casual meeting of Women & Gender eXpansive Coders DC (a local group I’ve become involved with over the past year) a Python user asked me this question, and boy did I stutter out a non-answer. I think I said something like, “Webpack is a build tool that magically bundles all your Javascript for the web.”
Does that sentence actually mean anything? I mean, I think I got the basics down, but I did use the word “magically,” so negative points for that. Also, pretty sure I inserted about a million “um”s as well.
I work with Javascript pretty much daily at work, but I’ve never really put much thought into Webpack or other Javascript build tools. That’s probably a good thing – after all, it shouldn’t be something I need to think about – but I decided I should have a slightly deeper level of understanding of these tools that are ubiquitous in modern front-end development.
For this post I’ll be talking about Webpack exclusively, but know that it’s not the only tool out there.
Okay, but what is Webpack, actually?
(Most) modern websites need Javascript to run. (This site uses no JS, thank you Jekyll.) Javascript used to be just added to the top of each page where you wanted to use it:
<!--index.html--> <html> <head> <script src="notavirus.js"></script> </head> <body> ... </body> </html>
//notavirus.js window.alert("Your computer has been compromised! Click here to download our malware remover!")
And that worked fine for years. It was all we had and we were okay with that.
-
Getting Unblocked, Faster: 5 Lessons from Journalism (and One Bonus Lesson) That Can Help You Ask Better Questions
Most loyal readers of this site know that before I was a software engineer, I was a journalist. I pivoted to my new career during the pandemic and have zero regrets! But there are certainly times I am grateful for my journalism training.
Frequently those times are when I need to get unblocked. I believe I can get unblocked faster than the average person at my level because my former career has taught me how to ask questions. Here, I’d like to share those tips so that you, too, can ask better questions.
1. Find your expert, and embrace the directed question
If you’re writing about the pandemic, you need Anthony Fauci on the line. If you’re debugging React, who’s your subject-matter expert?
At work, I try to notice who’s really good at certain tasks, whether or not they’re the official on-call for that task or service. I don’t hit them up all the time, but if a question in a public channel goes un-answered, or something is extra-urgent, I’ll send a quick DM.
Outside of work, I try to do the same, although sparingly. This blog is made using Jekyll, and for the most part I don’t have to know any Ruby to maintain it, but you absolutely bet I took notes when a woman in my local women-in-tech meetup was solving leetcode problems with Ruby one-liners.
Where else to find your expert? If your company has a formal mentorship program, get matched up with a mentor, and find out what they’re great at. Then say, for example: “I know we meet [biweekly, or whatever the time period is], but I’m new to [thing], and I know that’s one of your strengths. Would it be OK if I reached out outside of our set meeting times if I have a question about [thing]?”
Are you part of a tech meetup, Discord, user group (are those still a thing)? Sometimes a polite, respectful note to a helpful person there goes a long way.
All this does not overrule the idea that public conversations are, in general, better than private ones, because if your conversation is public, more people can learn from the discussion. But realistically, sometimes you just gotta get an answer.
-
Teaching a Reinforcement Learning Algo to Play Queens
Once you have created infinite games of Queens, you need to play infinite games of Queens. I don’t have time for that, so the next logical step is to teach the computer how to play, taking humans out of the equation entirely.
A very cool data scientist I know recommended getting to know reinforcement learning algorithms. These are the AIs that do cool things like speedrun Mario. Why not train one to beat Queens? Why not, indeed. Ignoring the part where I have no experience in machine learning and don’t think much of my math skills (I was a middle school mathlete, but I still don’t think much of my math skills), this should be fun. Follow along with me as I take my first steps into machine learning.
-
Site Updates for September
Frequent visitors to the site may have noticed some minor layout changes around here.
I’ve moved my list of projects to the top of the main page. Crucially, it is now mobile friendly as well.
Projects also have tags on them now to distinguish between
apps
(something that may be useful),games
(a full-fledged, playable game) andtoys
(things I made to mess around with). I may add more categories later.On the backend, projects are now a Jekyll
Collection
which in theory gives me more control over how to render them. And, if you reshare any of my posts, they now have improved open graph metadata. -
In Which I Go Down a Complete Rabbithole About Bash Completion
Ever wonder what is actually going on in your shell when you type, for example,
cd ~/myp
, hit<TAB>
, and the shell completes~/myproject
?Neither had I, until recently.
This was supposed to be a post about the next chapter of Efficient Linux at the Command Line, which is about navigating the file system. However, the author dropped in the idea of the bash builtin
complete
in a sidebar, and I might have gone a little off the deep end.In the source code given for writing a custom bash function, the last line added to the user’s config file is:
complete -W "work recipes video beatles" qcd
which would mean if someone typedqcd
followed by two tabs, the terminal would print all the available keys: in this casework
recipes
video
andbeatles
.What is this? What’s going on here?
If you type
complete
by itself, you get a very long list of what looks like nonsense:complete -F _longopt mv complete -F _root_command gksudo complete -F _command nice complete -F _longopt tr complete -F _longopt head ...and so on
This is, it turns out, a list of what completion command is run when you run one of the bash commands at the end of each line. In other words,
complete -F _longopt mv
means, if you typemv <tab><tab>
complete will run the function (-F
)_longopt
._longopt
and the other built in completions are very long bash functions that mostly call other functions, and if you want to spend a lot of your next three-day weekend retracing my steps, you are welcome to it. For the purposes of this post, however, I’ll talk about an overly simplified completion, because I already spent more time on this Labor Day weekend reading about this than I ever imagined I would.