Gitty up with baby steps

I just read this article by Ariel Camus on FreeCodeCamp about becoming a Git Master. While I understand the need to have branches when working with others, I have been slack to adopt that process when working on my own projects. That is changing.

Slowly. Slowly because I have to remember to do it, not because I am resistant. Swiss cheese for brains.

I returned to one of my early assignments. I had completed a vanilla JavaScript Hangman in time, but I felt it could be better. Upon completion, it functioned as a hangman game and had a nice look to it:

hangman

I’d like to have the chalkboard and window closer, but the last thing I’ll change is the styling. The first thing I did was add Gulp to bundle and watch. There’s a branch. Next up was to give it better functionality. When I turned it in, it had a word bank that did not have words or phrases, so I had no desire to deal with hyphens, apostrophes, or spaces. Next I wanted to add more word banks. One for different themes and have the players choose a theme. Currently, the only theme is “pants”. Then I’ll deal with keeping track of losses as well as wins before ending this with styling.

Instead of touching the master, that was good enough as it was and possibly ruining it, I created my first branch: tests. I have since finished the tests and added that new function to the branch and merged. Next up, I checked out a word banks branch. This is where I am now.

Such a great habit to get into and it took me this long to do it? No. Not really. I have done it before, but I just forget to. When I realize I need to be on a branch, I’m already working on the master. It would not occur to me to work on the master when I’m part of a team, so why is this hard to remember when it is just me? Maybe I should just rip myself a new one so that mucking up the master is something that terrifies me. Put a mirror on my desk to really make the argument with myself seem real. Storm out. Apologize. Make up with ice cream. I see this as a win-win sitch.

 

 

My Brain Hurts: recursion with factorials

With pencil and paper in hand, I have no problem with recursive patterns. Fibonacci schmibbo-hotsytotsy. Factorials schmacks-Oreos.

“Write a recursive function to …” blah mork loopy loo let me leave the interview now so you can continue with someone better, and I can drown my sorrows in two scoops of ImNotWorthy. 

I know this because it was not until I was asked to demonstrate recursion in a mock interview (I requested this topic), that I saw that my comprehension was passive. I understood it when I saw it. … ish. Understood-ish. But there was absolutely no active comprehension. I could not do it on my own. No ish. Nuthin. Fear? Nerves? A pebble in my shoe?

It is that whole “snake eating it’s tail” that was throwing me. I could not recreate what was going on. There is no stack with pencil and paper. I can write it out and do them in my head until I needed a calculator, but even with a calculator, all I needed was a line:

5! = 5 x 4 x 3 x 2 x 1

I understood stacks in other terms (callbacks, pancakes), but the recursion was hurting my brain, until I made it a literal stack in my head. I was treating the part of the code block after the base case as a spiral when (for me) thinking about it as slapping 3×5 cards down. No wonder I didn’t understand the stack; I wasn’t treating it like one.

I’ve been playing with recursion and different tasks as I plow through books on algorithms and tech interview skills. Factorials and Fibonacci are the easier ones to grasp. Not easy. EasIER. Comparative. Like farts smell better than decomposing bodies. They don’t smell good, just better.

I wouldn’t say that I could whip out recursion any time, and I know that I wouldn’t want to with factorials (O(n2) and all that), but I’m getting there. I spent some time on JSFiddle and with my markers to play.

factorial_recursion

The code is old news.

const factorial = n => {
if(n===1){
return 1; //my base case
}
return n * factorial(n - 1); //my nut case
}

I did not set include checking to see that n is a non-negative integer. That was not the point of my doodling because checking for that was not the hard part. This post isn’t about a fully-tested function to return the factorial of a number; this is about me getting the recursive part.

Ok to be the good-enough dev? Yepsilon.

Oh, I just know that would raise some hackles. “Good enough” sounds like one is lowering the bar. If I want to be just good enough dev, then I’m ok with bugs, sloppy code, side-effects, untested code. But what is the next level up from good-enough? Better enough? Hardly. Not if you care about spoken and written language. Best? Who is best? Perfect? Riiiight. You keep telling yourself that, tiger. Perfectionism is not our friend, nor are those who think they are perfect. So let us be happy calling what is not perfect “good enough”. Ok? Are you with me?

If you’re too code-y dev-y, then think about epsilon and any approximation algorithms. I have been watching MIT’s Open CourseWare (if only I could stop calling it Online CourseWare or writing MITOCD), specifically 6.0001 Introduction to Computer Science and Programming in Python with Dr. Ana Bell. While going over the approximate solution for finding a cube root, I re-encountered epsilon (ε, or error. To find a cube root of a number that isn’t a perfect cube, I have to be ok with getting close enough. Good enough, not perfect. See? Ok. Good enough seems less lazy now, doesn’t it? Sure. You were ready to label me lazy until I mentioned “algorithms” and “epsilon”. The larger my epsilon, the less accurate my answer will be, but it is still epsilon.

I’m never going to be perfect. I will never finish a project if I worry so much about perfection. But I can be good enough with an epsilon of 0.1. And the next iteration of that project, theme, or tutorial assignment could be good enough with ε = 0.01. More learning and practice and repetition and repetition and repetition will lead to ε = 0.0001. But I will never be perfect. And that’s ok.

What I want to say here this morning is that “the devil” is the spirit of fear that drives us into rigidity and anxiety, which saps our good will and clouds our compassion. The spirit of Love is where our allegiance lies as good people, spiritual people, people who want to make the world better place. Love is always in dialogue with fear in our souls and bodies and minds. So when perfectionism is sharpening its claws in you, take some deep breaths, stop comparing your insides to other people’s outsides, remind yourself to be a good enough witch, and wonder — what would this whole situation be like if I had more love.

(from The Devil and Martha Stewart, by Meg “OMG I lurv her!” Barnhouse)

CodePen Challenge: details

This week’s CodePen Challenge: details and her little bestie summary. I had no idea they existed, so chalk another one up to benefits of a challenge.

Confession time: I did not research too much about how to style the accordion function or even if I could. I did not find any need to with what I had chosen. Not this time. When I use details in a project, I’ll probably wonder more about the styling. When the week is up, I’ll peek at other people’s attempts.

I chose coffee types after looking at coffee graphics. I love posters that show how to make different espresso drinks. The theme announced itself. I had no choice in the matter. I’d like to style the cups more—maybe add a handle—and see if I could animate filling, but probably not for all of the drinks. Maybe the classic three: espresso, cappuccino, latte. Perhaps make an end-of-month challenge combo as a pure CSS entry.

We’ll see. Katy has big-idea-eyes and tiny-time-stomachs.

coffee_math

Pure CSS Images: Now what

Here I am so far. (I am using screenshots because my version is not responsive.)

mid-century modern prints
Original by Kerry Beary and my wip. (I believe she spells it -mellows and not -mallows because she’s punny.)

In terms of what is left to do that is furniture or furnishings, I have the lamp and interior of the pod. I can do those and stay pretty true to the original; however, when it’s time to do the cats …

What do I do? Do I make CSS cats that are not much like the original? There are limits with CSS. Do I make them in SVGs? I think if I do that, it feels too much like plagiarising. SVSs are a last resort. Or maybe just put a cat in the back and a person on the bench? Change it enough? I have no idea. Thankfully, I still have that lamp to do. I might animate that.

I’m exhausted.

CodePen Challenge: del & ins tags

This is my first CodePen challenge, and the topic is using the del and ins tags.

list of greyhound myths
Screenshot of my del and ins attempt

My applied creativity level was low for this one. I have never used del and ins and had to figure out what their default styles were and how I could alter them. The examples found on CodePen are fanbloodytastic. I’d like to play more with del and ins and include animations like this one by Mark Praschan or make the strike-outs more organic like the school essay example by Halida Astatin (also has great animations). These were just a few. I had to back off the CodePenChallenge rabbit warren to stay focused.

This challenge didn’t excite me as much as others I have seen; however, since I did not know about del and ins, I found value in it. Learning can’t always be snazzy. Now that I have explored the other submissions, I could snazzy up my edits.

Checkers did my head in

My current Pure CSS Image attempt is this gem from Kerry Beary.

I cannot tab in my code snippet, so just deal with it. (It even hurts my own eyes.)

@for $i from 1 through 7{
.#{rectangle-band}-#{$i}{
margin-left: 0px;
@if $i % 2 == 0 {
@for $i from 0 through 3{
.#{square}-#{$i}{
margin-left: $i*60px;
@if $i % 2 == 1 {
background: $evenband;
}
}
}
}
@if $i % 2 == 1 {
@for $i from 0 through 3{
.#{square}-#{$i}{
margin-left: $i*60px;
@if $i % 2 == 0 {
background: $evenband;
}
}
}
}
}
}

Iterating in Pug. Iterating in Sass. Nesting them. Checking for odd or even. ERMAGERD! But I did it.

Screen Shot 2018-05-07 at 1.38.12 PM

For now. But looking at it above, I see that the chair is too big. No. I’m not going to fuss. There are times to let it go. This is one of those times.

I have to get circles or semi-circles in there. That’ll be a new set of curse words. Let me just admire this for a second!

Ok. Done. Now I have to dry heave.