Today I merged in my main refactoring work back on the mob coding app, closed a couple other issues, did some research on GitHub Universe, spent the evening talking about Git workflows with techies at a meetup, went for a long walk, stayed up late watching tech talks, and started reading “The Extravagant Universe” by Robert P. Kushner.
9:36am: This morning, I woke up really early despite staying up really late, so I guess I’m back to the biphasic sleep experiment! I feel pretty good though. (Mostly because I drank a lot of coffee, continuing this new tradition of getting that 85 cent sea salt coffee from the bakery down the street!) I already did a bunch of brainstorming, listing out ideas for projects I want to work on next, and I also applied for a scholarship ticket to an upcoming software conference. Fingers crossed!
Personal check-in: I made some goals for this week and took stock of everything I did this weekend, since I’m still keeping a list of “small wins” for each day, and I’m still planning one “self-care” activity each day and writing them all down to share with my therapist later. (It feels weird writing “my therapist” because I’m not used to that being a normal part of my life again! But destigmatizing therapy is definitely a good thing. The jury is still out on whether it’s doing me any good, but it certainly doesn’t hurt to try.) As far as anxiety and depression go, being a little sleep-deprived and drinking some coffee does wonders for my mood! Yesterday was very refreshing too: I played dodgeball for the first time as an adult, joining a group of friends for a pickup game at a local community center. It was intense! And a great workout! I had so much fun, I want to make that a regular hobby now! Then we went rock climbing immediately afterwards, bought fresh fruit from a nice woman at one of those street carts with the rainbow umbrellas, got tacos for dinner, got vegan ice cream, walked around the lake in Echo Park, and spent the whole night playing board games! It was the perfect Sunday.
Any anxiety I felt earlier just melted away; I was actually living in the present moment, and for most of the day! The feeling lasted even after the day ended, and the most amazing part is that it continued into this morning! Usually, if I go to sleep in a good mood, it seems to dissolve once I get a full night’s rest. I’ve noticed that purposefully depriving myself of sleep tends to stop that from happening. Waking up after only 5 hours of sleep, I felt like today is just a continuation of yesterday – like my brain never hit the “reset” button. Once I take a nap this afternoon, it might finally happen. But I hope not. Right now, I feel relaxed and happy and motivated, excited about all the possibilities ahead of me and super grateful for the luxury of being able to work on whatever I want to work on all day and all week! THe only downside is that I have an upset stomach because of all this caffeine I just ingested. (Meh, still worth it!)
9:47am: Before I forget, I’m going to make a new GitHub issue for the mob coding app to remind myself that maybe I should be using the current player ID instead of an index for that state variable. OK, done. Now, to review my goals for the week and get the ball rolling on a couple of my next projects…
Goals for this week
I was keeping this list in a separate document for a while, but why not just keep it here? I don’t care if it’s public – plus, maybe the extra sense of accountability will motivate me!
- Resume biphasic sleep schedule. Target: sleep from 1am to 7am and nap from 2pm to 3:30pm!
- Plan a self-care activity every day and write them down (to share with therapist on July 20th)
- Publish these daily learning notes every day
- Lose 1 pound (based on comparing weekly average)
- Proactively fight anxiety with curiosity, meditation, and time with friends
- Finish mob coding app version 1, completing all of my refactoring tasks
- Submit talk proposal to GitHub Universe by Friday
- Learn about Redux and try it out!
Next steps for Learn Teach Code projects:
Schedule next batch of Monday meetups for July and August, coordinating with my collaborators on the dates
For next web dev study group on Wednesday: try a scavenger hunt / knowledge-sharing activity!
Reach out to venues about hosting a downtown community hack night of our own
Reach out to venues about possible lunch-time workshops
Decide on format(s), topics, and venues to try next for paid workshops
Decide if I want to repeat the UnBootcamp experiment again in August, if I want to dedicate my Saturdays to teaching again, or if I’d rather try something different!
That’s more than enough for right now! As for today, I plan to send a couple emails to get the ball rolling on some of these ideas, and then focus on the mob coding app. I also want to do a little research on my ideas for a GitHub Universe talk and the related project ideas of GitHub as a learning management system or a collaborative tutorial platform!
10:54am: Not sure where the last hour went. I got distracted by the internet! I am definitely sleepy and unfocused, but still feeling good and creative and motivated. I’m really hungry though, so I think I’ll get a snack and take a quick break and then return to the mob coding app for a while, probably until it’s nap time.
11:07am: Eating a free half of a sandwich I found in the fridge. Hopefully it hasn’t gone bad! OK, where did I leave off with the mob coding app… Right, I’m basically done with the main refactoring task, but I just wasn’t sure if I fixed all the new bugs! I don’t have a testing framework or anything. I guess I could try writing up a list of things to check for, as a start.
Tests for the mob coding app:
Single player: turn change still works, player creates Gist, player edits their own Gist at end of every turn, UI updates properly
Two players: turn changes, players fork/edit Gist, and UI updates all according to plan
Two players: if current player disconnects, turn passes to next player and everything described in the above still works
Two players: if other player disconnects, nothing should really change except the UI
If a new player joins at any time, nothing changes except the UI
All the bugs I found were edge cases related to players disconnecting, and I’m pretty sure I fixed all of those, so I feel pretty good about this now! I’ll try testing it one out more time, and if everything works, I’ll just consider this step done.
11:22am: As far as I can tell, it works perfectly! Wow! Now I can finally make a pull request and close issue #16!
12:00pm: I made some more changes to my code, reviewed and wrote up a list of changes for this latest pull request, updated the project log and some of the documentation, and merged and synced everything back up. Now I’m finally ready to move on to the next tasks! What should I work on next? Hmm. Taking a look at my list of issues…
12:13pm: I feel like taking a little break, so I’m going to do a couple math practice problems on Khan Academy now.
12:20pm: Cool, I finally finished 5th grade math! Yay! I don’t feel like doing any more than that, though. I’m also feeling really sleepy right now. Maybe I won’t try to finish this coffee after all… maybe I’ll just try to get sleepy enough within the next hour or two so I can hopefully get in a good nap this afternoon. This seems like a good time for a quick break, and then I’ll dive into the next programming task.
12:38pm: Eating some Greek yogurt and almond butter, my current favorite and weirdly delicious snack! I’m sitting on the couch now too, since I felt like being comfy. It’s enough of a change of scenery that I feel like I’ve moved to a different place, even though I’m only a few feet away from the table I was sitting at before. OK, time to make a decision! I’ll pick issue #15, sending the GitHub access token as a header instead of a URL parameter. How do I send custom headers with an AJAX request?
12:48pm: Piece of cake! All I need is the
XMLHttpRequest.setRequestHeader() method! You use it after opening a request, but before sending the request. Let’s try this out… First I’ll make a new branch for this, and then I’ll find the right spot in my client-side code to make this edit, and then I’ll test it. By then, maybe it’ll be nap time.
Oh wait, I’m already doing this! I looked up the wrong thing. I wanted to find out how to get the token out of the header on the clients. Oops! Well, first I need to send the token in a header from my server to the clients. Oh, but I”m redirecting the clients… I have a feeling that means I can’t also send something as a request header. How do redirects work, anyhow? Time to look that up… Oh, it seems pretty simple!
I found this StackOverflow thread that suggests it’s as easy as setting a header with Express before doing the redirect. But I also saw other StackOverflow threads that indicated this wouldn’t work, and I don’t know enough about any of this to know who’s right and who’s wrong! I’ll just try it out.
1:03pm: Looks like it works! I see the header in Chrome developer tools. Neato! OK, now how do I retrieve the access token from the header on the client? Ah, it’s as simple as
But my brain isn’t really working anymore, so I think I’ll put this aside for now and instead do something more exploratory and creative. I’ll watch some of those GitHub Universe talks and make notes on ideas for my GitHub project and talk proposal!
Notes on GitHub Universe
Review the GitHub Universe 2017 CFP details, of course!
Read Katrina Owens’ advice for GitHub Universe speaker proposals and watch her favorite talks from 2016! (See all the 2016 talks here.)
I watched the GitHub Universe 2016 recap video – short and sweet! Looks like a fun time!
Apparently my idea sort of already exists: GitHub Classroom “automates repository creation and access control, making it easy to distribute starter code and collect assignments on GitHub.” See also the GitHub Classroom repo (it’s open-source, of course!) for more details and source code! (After watching the overview video, I see that it’s very different from my idea, but it does still look like a very handy feature.)
Look through the GitHub Education Community site to get a sense of how other teachers and organizations are using GitHub and managing their workflows.
I started watching the GitHub Universe 2016 opening keynote by GitHub CEO Chris Wanstrath. Apparently next year will be GitHub’s 10 year anniversary! That’s huge! I also really like their theme of “continuous improvement” over “lightbulb moments”.
2:04pm: Time for a (hopefully) nice long nap!
3:52pm: Well, that was not satisfying. I got up after 40 minutes, and I think I only slept maybe 20 minutes. Still nice, but not enough. I had a bite of free leftover beans, chips and guacamole, and now I’m having another sip of this morning’s coffee drink. Yeah, there’s definitely a problem with the biphasic sleep schedule: it’s hard to get enough sleep during the day! I have to get just the right balance for caffeine intake and sleeping at the right times, and even then, interruptions can make it difficult to sleep. Plus on the weekend, I usually can’t schedule my day around taking a long afternoon nap! But I guess I’ll try to stick to it for the rest of the week and see how it goes. A happy medium might be sleeping closer to 7 hours at night and taking a 30 minute nap each afternoon. Hmm. I also don’t have a backup plan for what to do when I don’t get enough of a nap! Should I try to take a second nap? Should I just go to bed earlier? Both? The one thing I don’t want to do is wake up later. I love those early morning hours, and I love walking to the office before it gets hot out. Anyway, I’m awake enough for now. I did three sets of 10 pushups upstairs in the break room and played a bit of pinball. I’m putting my headphones on, listening to my usual electronic music playlist that I associate with focused work, and I plan to work on code until I either need to take another nap or until it’s time to walk over to that Git workflows meetup I wanted to check out tonight just up the street.
So where did I leave off… OK, I’m reviewing my notes from June 21st, where I reviewed the user login and authentication flow. The client makes an AJAX request to the server right away to get the client ID to then generate the login button link (since I’m not doing any server-side rendering at all right now). Instead of making two AJAX requests, one for the client ID and one to check for an access token in the headers, I may as well do them at the same time! I should be able to check the headers and base my current conditional statement on whether the access token exists in the header or not. I realized that just before I fell asleep for today’s nap. Yay, unconscious problem-solving!
Oh, wait… In order for this to work, I’ll have to start saving the user access tokens on the server, and then if multiple clients are logging in at the same time, how will the server know which client to send which access token to? Hmm. I guess the server could assign clients to some random unique IDs to remember them by. I could just use that temporary GitHub code for that purpose. What would that look like… I need to scriblle stuff on paper for this I think! My brain still isn’t working very well, haha. I can’t visualize the process in my head.
4:33pm: Got distracted and spent some time answering messages and updating my calendar. Looks like I’m meeting a friend for daytime rock climbing and coworking at Cliffs of Id on Wednesday – should be fun! And it sounds like another friend of mine is having a lot of success so far with her own series of project-based programming workshops, which is very inspiring! (We talked before about all the things I would do differently if I did something similar again, hoping she could learn from my mistakes, haha. Sounds like she got it right! Woohoo!) Anyhow, I got out a pen and paper but already forgot what I was doing. I feel very, very sleepy right now. And probably hungry. In short, I don’t feel like working. But I’ll try to push through the next two hours. I’m going to eat my emergency protein bar and sketch out some ideas for this new authentication workflow.
4:48pm: All I can think of is to save the temporary code and access token on the server, and then provide another route for clients to make AJAX requests to in order to (once again!) exchange the temporary code for the access token. Seems like a lot of extra work just to be able to send a piece of data in a header instead of as a URL parameter, but I can’t think of any other way (unless I just have the server handle all API calls, which I do want to try at some point). Maybe I’ll make a flowchart to illustrate this workflow, but for now, here’s an outline:
Mob coding user login flow using headers for access token
The first three steps are the same as before, and then it’s different from the end of step four onwards:
Client connects to server, establishing a WebSocket connection, and checks if a temporary code exists as a URL parameter. If none exists, the client makes an AJAX call to the server’s
/github-clientroute, and upon receiving the GitHub client ID, the client displays the GitHub login link using the client ID. (Later I’ll probably just use server-side rendering/templating to accomplish this step!)
User clicks login link, gets redirected to GitHub, and accepts permissions to authorize the app.
GitHub redirects user to
/github-authroute with a temporary code as a URL parameter.
Server makes a POST request to GitHub to exchange that temporary code (along with the client ID and client secret) for an access token, saving the temporary code in an object.
Upon receiving GitHub’s response, my server also saves the access token, linked to the temporary code in that object. Then it redirects the client back to the app homepage with the temporary code – not the access token this time!
The client checks again if a temporary code exists as a URL parameter; if it does exist (and now it should!), then the client makes another AJAX call, this time sending that temporary code to the server’s
/github-tokenroute (may as well send it as a header!).
The server checks if the received temporary code is stored in the object, and if so, it sends a response to the client with the corresponding GitHub access token as a header. (And I still need to handle what should happen if the code doesn’t match or if it’s already expired!)
I don’t like the look of a long code appearing inside the URL bar, but maybe it would actually be useful… if the user gets disconnected or something and refreshes the page, if the temporary code is still good, I think that could save one API call to GitHub instead of authenticating the user all over again! Of course, this would also break the app if the temporary code is no longer valid. I’m not sure if these codes work more than once, actually. So I have a few questions to explore next.
Next questions on GitHub authentication flow:
Do GitHub’s temporary codes work more than once, or do they expire as soon as they’ve been exchanged for an access token?
Clearly the next step in usability here is to implement sessions, but what’s the right way to do so? Where should I even start?
5:14pm: Wow, the HTML5 History API is cool! I can use the
history.replaceState() method to change what the URL bar displays and also change the browser history. Crazy! It looks like I can also use the
Window.location.replace() method to change the URL, but that actually reloads the page, which definitely won’t work because my app has no sessions! It only works as long as the page is open and not refreshed!
5:36pm: Well, I tested out a few of these history tricks in my browser console and they do seem to work! I couldn’t find more documentation on MDN, but that first link I found has enough information to start using it. OK, time to implement the new code! Let’s try this out!
5:58pm: I had to look up how to retrieve headers from a request using Express, but it’s easy with
req.get() or its alias
6:28pm: Yay, it works great! It does feel a bit convoluted, but hey, problem solved! The access token is no longer sent in the URL parameters and the URL now looks nice and clean. I’m still not following best security practices, but at least it isn’t as blatantly wrong as it was before. Well, time for me to leave soon to head over to that tech company’s office for what I hope will be an interesting meetup on Git workflows!
10:35pm: Back home now, sitting in bed, melting a bit and sipping hot tea because I heard that actually helps cool you down somehow. Either way, it’s tasty. I just cooked myself a couple of eggs (they came out perfect!) and indugled in a couple ‘smores. The meetup was OK; not as lively as I hoped, but it was still very cool to have an excuse to spend a couple hours talking about Git workflows. I learned about that trendy “Git flow” style and how it differs from the “feature branch” style and others. Then I walked a good couple of miles to get my car, which I left at the nearby climbing gym a couple days ago. I was starving when I got home, and I still feel hungry! But I’ll try not to eat any more tonight.
I got a second wind this evening, and I’m still not tired yet! So I think I’ll watch another talk… Katrina Owens recommend this GitHub Integrations talk from GitHub Universe 2016 by Keavy McMinn. Sounds super relevant to me, both for my learning goal and as an example of what GitHub is looking for in their talk proposals!
11:02pm: Well, it was just OK. Well-organized and clear and informative, but I guess I wasn’t that interested in the topic of how GitHub integrations (now called apps) were developed. Anyway, I feel like the bar isn’t that high for talks – these aren’t TED talks, anyhow! So maybe I have a chance here!
Next talk: “Crossing the Canyon of Cognizance: A Shared Adventure” by Pamela Vickers.
11:20pm: I thought that one was just OK, too. She did a great job, but for me it’s a topic I’m already very familiar with, so I wasn’t all that interested in it. I do love her use of story and cartoons and humor, though! OK, last recommended talk: “Lending Privilege” by Anjuan Simmons. Ah, I might not actually watch this one… I was hoping to find more examples of technical talks. Eh, I guess I don’t feel like watching any more talks right now. Maybe I’ll just try to go to sleep early. I could use it!
Wrapping up: I didn’t fall asleep for quite a while, but I did start reading “The Extravagant Universe” by Robert P. Kushner. It’s all about the discoveries that led up to the discovery of dark energy causing the expansion of the universe, expanding space itself! Cool stuff.
Just found this very nice open source project: ORY editor, a “highly customizable content editor for the browser based on React and Redux.”
This front-end dev study guide by Grab looks great!
Maybe watch this video later: Everything I Wish I Knew When I Started Using GitHub
Try these Atom extensions: git-time-machine for viewing past commits and markdown-pdf to generate PDFs or images from Markdown documents. (I found these from the GitHub Universe 2016 opening keynote, recommended by GitHub’s CEO himself!)
Remember to watch more GitHub Universe 2016 talks for inspiration and knowledge!