Drove down to NYC this morning. It's amazing how even while driving when so much is going on, you can clear your mind. Guess it's similar to walking. You are focusing on the task, but the mind still has some space to wander.

Long walk today. Walked faster than usual because it was windy and we wanted to get as much in as possible before any rain. Missing normal workout with KJ tomorrow since I’m heading down to NYC to help Latika pack up her apartment ahead of our move. I won’t be going outside then (thanks covid) so will probably do RingFit.

1

Vapor

Bunch of random stuff today

- Learned about downloading and uploading data
- Intro to Vapor
- I really like guard statements in Swift

Also, Setting up Vim to work with Swift/Xcode. I like using Vim because I'm much faster editing text with it, but Xcode is good because it allows you to change certain configuration properties while developing. The problem with Xcode is it is slow to work in (reformatting, navigating around files, etc.).

Did a quick test of editing a file in Vim and Xcode grabs the file's changes when I save. I can use a coc extension to get autocomplete, go-to definition, etc. working. I can also use SwiftLint through Vim to take care of prettying files on save. I've even seen some extensions to build and run on devices from the command line too.

For now, I'll continue with running from Xcode, but will try to edit text mostly from iTerm (Tmux with Vim) after my config is set up. (Hopefully this isn't a huge waste of time lol.)

Note: I've also looked into using XVim, but it seems unstable.

Thinking about building a simple multiplatform app with SwiftUI to view tweets. This would allow me to control how much I consume more directly than using the Twitter app (or another client). I could have the app only show a specific number of tweets per day, not work on weekends, etc. I'm also learning how to build native apps right now so I could feed two birds with one scone.

Went for a walk with my mom and sister. It’s fun to walk at a brisk pace and chat. Need to find someone to walk with when I’m back in the city.

Learned basics about concurrency on iOS: NSThread, Grand Central Dispatch, Operations Queues, and Combine. Started working on a simple app to download songs and album artwork. Need to use URLSessions and GCD for this part of the course. Main takeaway:

DispatchQueue.main.async {
  // Update UI on main thread
}

Worked out with KJ via Zoom again. Each group three times, then stretch at the end. (Not sure I'll list every workout like this in the future.)

Group 1
- Barbell squats
- Single leg glute bridge from hands
- Barbell Deadlifts

Group 2
- Dumbbell chest press
- Dumbbell single arm rows
- Dumbbell pull over

Group 3
- Dumbbell lateral and frontal raises
- Forward lunges
- ???

Group 4
- Dumbbell bicep curls
- Dips on bench
- Crunches

Need to figure out what I'm going to do for weights when I head back down to Brooklyn midway through the month. These look great, but are out of stock. Might be stuck doing body weight stuff for a while.

Is it worthwhile to disconnect at all? I think it is, but was thinking about this question more. Some basic pros and cons.

Pros
- More time to do other things
- Less external stimulation
- Clear headspace of other ideas and random things

Cons
- Less time to do other things
- Less entertainment
- Less connecting with folks online/learning about new things

I'd like to find a way to spend less time on Hacker News, Twitter, etc. but still be able to hear about new things (i.e. tech, news, people).

Thinking about a way to ease back into using Hacker News and Twitter again. Some questions I'm asking myself.

- How many times per day do I allow myself to use? Once, twice, or more? Time limit?
- Trade-off between using in the morning versus at night?
- Mobile and/or desktop?
- When is enough? When you are eating food, your body tells you when you've had enough. When consuming digital content, how do you know you are full?

So far I think I'd like to set a rule where I use HN and Twitter only on my computer during weekdays in the early to late afternoon. It will be an intentional time set aside for checking both. Hopefully, it won't become an impulsive habit then.

I will stay signed out of HN and Twitter when I'm not using them and turn on a custom Stylus rule that hides the page HTML.

Going to keep thinking about these type of questions and come up with a plan before returning to both.

Back home so did a quick workout: Pushups, one arm rows, and lateral raises, then bicep curls, tricep extensions, and crunches. (Both exercise groups three times.) Also, going to go for a 40-minute walk around the neighborhood later.

My exercise over the last two days was moving stuff around in New Hampshire. I was on my feet all day from 10a to 7p. Lots of bending and lifting too.

2

Spending the last couple days in New Hampshire without Internet was refreshing. When Latika and I move into our new place August 15th, I'd like to have at least one day every week where the router is switched off and phones are set to airplane mode. Disconnecting for a day or two is centering. Your mind ends up wandering and along the way you can get into deep focus.

I’m heading up to New Hampshire for a couple days to help my mom clean up the house. The Internet hasn’t been set up for a couple years so it’s an explicit barrier to using a device. When I think about methods for disconnecting, a lot of people (including myself) tend to block themselves from accessing stuff. Creating barriers, like using iOS Screen Time or not having Internet access, seem effective, but not sustainable.

Ideally, my brain changes enough so I can rely on self-discipline instead.

Starting to play around with SwiftUI more in Playgrounds than inside apps. It's faster to get instant feedback and try concepts out. Today, I was prototyping with timers. Here's a shell for getting SwiftUI and Playgrounds working.

import SwiftUI

struct ContentView: View {
  var body: some View {
    Text("Hello, World")
  }
}

import PlaygroundSupport
PlaygroundPage.current.setLiveView(ContentView())

I wish I started this earlier, but here goes. Today, I did the usual weightlifting I do on Mondays, Wednesday, and Fridays. I worked with my KJ via Zoom and did a full-body workout for an hour.

On Friday, I'm going to the New Hampshire house to clean some things up with my mom. Will need to figure out a way to get something still in. Later today, I'm going to go for a 40-minute walk around the neighborhood with my sister. We started doing this a every day a few months ago.

1

It's frustrating that SwiftUI isn't as far along as I thought. I was trying to do a few things with Lists earlier today and there are a few random bugs. Hopefully they get fixed in the next Xcode Beta.

I have a lot of extra time in the during the day now since I'm not going on Hacker News. I started using Hacker News five or six years ago and it became an integral part of my life. I posted products that got some interest and learned a lot from the community. My brain has ⌘+t, then n+Enter wired whenever I'm using a browser.

At some point I'd like to return to using it because it's been valuable, but I don't need to go on it many times a day like I did before. Nothing really changes that often! All I ever do is refresh the frontpage and look at the same stuff over and over again. I'm hoping me truly realizing this helps me change my behavior when I let it back into my life.

Took a break from guided learning over the weekend and messed around with SwiftUI in another project. Today, I resumed and learned more about Codable. Specifically, how to assign different names for properties when writing to files, reading data from an API, etc.

struct Task: Identifiable, Codable {
    let id = UUID()
    
    var name: String
    var completed = false
    
    enum CodingKeys: String, CodingKey {
        case id = "identifier"
        case name
        case completed = "is_complete"
    }
}

Spent some time in bed reading and replying to text messages. In the past, I think using my phone in bed in the morning helped wake me up, like coffee would.

There are less things to read in my Instapaper backlog because I'm not saving new stories from Hacker News, Twitter, etc. I do feel like there is some stuff I'm missing, but I don't know at all what it is. Overall, I feel less scattered and reactive.

Finished a section on building user interfaces with SwiftUI. I need to remember to use GeometryReader for getting programmatic access to a view's container frame and layout. This is useful for calculating child size based on a parent, laying out a group of items inside a container, and I imagine much more.

Next, I started learning more about data persistence using FileManager to write and read contents. I briefly started learning more about the Codeable protocol. I remember hearing about Codable a few years ago so excited to start digging in to it.

I've been doing a lot of structured/guided learning lately from online resources and courses. I know enough about SwiftUI to be dangerous so at some point I think I should start building something, and learn as problems come up.

The most challenging time to stay under control is when I’m tired. My brain searches for snacks. I’ve noticed that I haven’t had to rely on the blockers I put in place on my phone and computer yet. I’ve had enough resolve to stay away. One thing I’m worried about is my brain getting attached to new snacks. Websites that I wouldn’t have spent much time on before, but are the only things left to snack on. Stale chips. NYT Cooking could be one of those things.

Was more challenging to wake up this morning (snoozed my alarm for an hour) since I went to sleep later.

I watched an hour of TV with my mom and Facetimed Latika right before bed so I only read for five minutes and did shortened breathing exercises.

Even though I didn’t use any “banned” apps I still need more time to clear my mind before going to sleep.

2

Played around with Sign In With Apple and animations.

I’m conflicted as to use SIWA or not because you’re giving away a lot. It is super simple though. Trade offs.

2

Woke up this morning and immediately got out of bed since I signed out of Tweetbot and blocked websites I usually visit in Safari (i.e. Hack News). Once I got up, I did some breathing exercises in Oak. By doing these two simple things, I cleared my mind to start the day and didn't waste 30+ minutes in bed.

1

Today I first learned more about container views in SwiftUI: Stacks, like HStack, VStack, ZStack, how SwiftUI's layout system works, Lists, Forms, Scroll Views, Navigation, etc. I remember doing all these things in UIKit being much harder and needing a lot more code.

Next, I learned more about binding data to views. Some random notes:

- ObservableObject protocol with @Published property wrapper on properties you want to watch for changes
- @ObservedObject property wrapper
- @Binding property wrapper
- .environmentObject(someReferenceType) used with @EnvironmentObject property wrapper to inject dependencies

Lastly, I got an intro to accessibility with SwiftUI. In the past, I haven't done a very good job of making things I've made accessible. It's always been an afterthought because I'm privileged not to need assistance. SwiftUI and iOS makes it easy so I should be adding and testing accessibility from the start as I get into making my own apps. I added a VoiceOver toggle to the lock button if I triple press it.

Some notes on VoiceOver accessibility:

- Passing a decorative property to Image removes the label from being read by VoiceOver Image(decorative: "ImageName")
- You can hide elements from VoiceOver completely with .accessibility(hidden: true) modifier
- You can provide a more understandable value with .accessibility(value: "Some value")
- Call out specific headers for VoiceOver to recognize .accessibility(addTraits: .isHeader)

There are many other accessibility features besides VoiceOver that I still need to learn more about. In the video I watched, it said Apple has three questions to keep in mind when developing for accessibility:

1. Do displayed strings provide enough information?
2. Would a custom action simplify the interaction?
3. Can you speed up navigation?

After using my phone with VoiceOver for a bit, number three resonated with me the most. It takes a while to navigate around with VoiceOver (Iam very experienced with it). I can see how if an app doesn't provide accessibility support or creates custom elements instead of using Apple's accessible versions, it can be very frustrating to get to where you want to go.

Multiple content previews for larger type and dark color scheme:

struct ContentView_Previews : PreviewProvider {
  static var previews: some View {
    
    Group {
        ContentView()
            .environment(\.sizeCategory, .accessibilityExtraExtraLarge)
        ContentView()
            .environment(\.colorScheme, .dark)
    }
  }
}

Woke up late so didn't have as much time this morning. I learned about protocols and extensions. Protocols define requirements and extensions allow for default implementations of those requirements. Here's one useful for accessing ColorSets defined in the asset catalog:

import SwiftUI
extension Color {
    public static let background: Color { Color("Background") }
    public static let brand: Color { Color("Brand") }
    public static let text: Color { Color("Text") }
}

Instead of typing Color("Brand") everywhere (since it's prone to misspelling, etc.), you can do Color(Color.brand).

Also, spent some time playing around with Classes in Swift and inheritance. I already know about polymorphism so this was just practice with syntax.

1

Found this notebook because I ran out of printer paper to scribble on. It has my old Swift notes from 2014-2015 in it! Pretty cool that this loop is continuing again some five years later.

Learned more about programming in Swift:

- Functions: overloading and advanced parameters
- Closures
- Enums: CaseIterable, switch statements, associated values
- Properties and methods: stored, computed, and lazy

I used JavaScript for so long, I forgot how good other languages are. This syntax for swift is really clever:

let numbers = [2, 30, 19, 6, 71, 100]
numbers.reduce(0, +)

Made a tasks app and learned more about SwiftUI views, file organization, binding, different types of navigation views, and models (extensions, protocols, enums, nested types).

I’m still amazed at how fast it is to create decent looking interfaces with SwiftUI. Also, the data binding reminds me a lot of Angular.js and Vue.js.

Made a super simple iOS app, called Bull’s Eye, in the intro course on Ray Wenderlich. It was pretty boring at times because the course caters towards folks with zero to no coding experience. I listened at 2x speed though so got through fast.

I’m conflicted whether or not to continue with structure, like the course, or just make my own stuff.

Also, learned more about navigation, view modifiers, and alerts that were useful.

SF Symbols - SF Symbols - Human Interface Guidelines - Apple Developer

Finished all 10 videos from Primitive that are released. Learned about a bunch of things:

- Basic Xcode shortcuts (cmd+shift+l to open Library, cmd+option+p to start preview, etc.)
- How to use custom and system fonts
- How to use SF Symbols
- Colors (creating color sets in xcassets is super nice)
- Chaining modifiers
- Layout
- Reusable subviews

SwiftUI has come a long way since I looked at it last year. Subviews are really smooth and just work. You don't have to import them like you do with components in JavaScript. I'm excited by how fast it is to throw together good looking interfaces and put them on a phone.

Until there are more Primitive.school videos out, I'm going to switch over the Ray Wenderlich.

A lot of projects I work on tend to be all-consuming. They take over my brain. It makes it hard to be present. Until I find a healthy way to approach the work, I need to take a break for a bit.

I hope to be back soon!

8

Added some demo-able things:

- Placeholder for empty document so you know you can type something in the blank space
- Quick dark mode that hooks in to system preferences
- Added basic vertical rhythm so headings, paragraphs, etc. have some room to breathe

I wasn't handling line breaks and blank lines so I added in some logic to account for both those cases. It got tricky when an inline mark (bold, emphasis, etc.) was split because line breaks are valid in markdown.

__foo bar
baz__

Even though it's unlikely I will split bold text across lines like this, someone might. I think it's important to spend extra time right now to get the little details right.

The editor also handles backlashes better than before too. Adding backlashes or escaped characters (\@) shifted the showing/hiding syntax off track before.

Finally finished updating the parser. Now I have more robust support for complicated markdown variants like heading closing sequences and leading characters.

Switching from marked to remark for parsing markdown since it's more flexible and marked had a couple annoying bugs, like mangling emails.

This will take a few days so nothing to show in the meantime. Need to make the foundation strong.

Finish a basic implementation of headings. Headings can contain marks instead them. Heading syntax disappears when the cursor is focused on a different line.

1

Got carried away today and did something unnecessary: I named it and designed a landing page. It was fun, but doesn't matter. I'm building this for myself.

Late last night I added delete/update markdown. Even though the implementation is a little greedy, it felt great to finish it in much less time than I was expecting.

Today, I made some more improvements to nested marks (i.e. bold inside italic) and added support for links: markdown-syntax, autolinking, and email detection.

Part of my brain is nervously waiting for something to spring up that halts progress. There are already some small bugs, but nothing show stopping. I can fix them later.

3

I started building a notes app for myself.

All the notes apps I've used in the past (iOS Notes, Notational Velocity, Simplenote, Notion, Roam) never quite did what I wanted. I'm a software engineer so figured I might as well try to build a tool I use everyday.

Right now I'm focused on building the editor and haven't thought much about anything else. The goal for the editor is to combine markdown syntax and preview. Syntax shows up when you need it to, and disappears when you don't.

Beyond that I'd like it to be ridiculously performant, work offline, and automatically create a new daily note every day that you can start dumping your thoughts into.

It's unlikely that it ever supports collaboration, tables/databases, slash commands, etc. Those things are for the enterprise and teams or non-technical users. This app is just for me.

My current reference sheet I have a bunch of commands on that I’m trying to memorize or reference frequently.

I started using vimwiki to keep track of things I learn while I'm coding. I can quickly open it, and jot something down or reference a previous note. This is super useful because it's in my terminal with vim, tmux, and friends.

Not sure how I'm going to use this log going forward now. I love how helpful it's been, but don't want to duplicate knowledge in two places.

Got the bike out of the garage. It was hiding behind some stuff. I walked it outside and took some pictures. Everything looks "okay" (nothing is bent or visually off), but I'm not an expert.

There wasn't a lot more I could do with the bike today so I headed to my computer for research. I started an are.na channel to capture links, videos, and pictures. I'm just trying to learn anything right now. I feel like I'm trying to keep my head above water.

I learned why the bike is a ten-speed. Two gears in the front times five gears in the back.

I've used folds sparingly so far because I didn't really know how to use them. Earlier today, I had to edit a really large JSON file and it was a pain to navigate so I decided I should try out folding it.

All I had to do was add set foldmethod=syntax to my vimrc and I was off! I previously installed vim-polyglot so it was an extra bonus that it brings in syntax files on-demand to help with folding.

One of the side effects of how I use Vim is a lot of buffers are opened. I'll make some edits, then switch to a new file, keeping the buffer open, either in the background or foreground.

Once they start piling up, it's a paid to open the buffer list, navigate to each buffer, and close them all. I thought there had to be other people with this problem and found a plugin that takes care of it for me. close-buffers.vim give me the ability to interactively select buffers to close, close all hidden buffers, and several other options.

I just used my first Vim macro!

I knew they were super powerful, but I was avoiding them because the seemed like something hardcore Vim users used. I don't think I'm hardcore (yet). I've only used Vim for a month and a half!

Anyway, I was working in Patreon's code base and had to internationalize a bunch of strings so I recorded a macro to change 'some string' into __('some string'):

qd
ysa'(
i__
q

Now whenever I call @d, I save a few seconds.

My vimrc was getting disorganized after tinkering with it over the past month so I organized it into sections: Plug General, Appearance, Key Mappings, Leader Commands, Plugins, Coc, Autocommands, Commands, and Functions.

These sections are pretty self-explanatory, except I separated out "Coc" into it's own section out of "Plugins" because it has a bunch of extra configuration.

I also added a foldmethod comment (" vim:foldmethod=marker) so all the sections are collapsed when I open up my vimrc to change something.

This is a picture I took almost a year ago of my dad's old bike before my family moved out of the house we grew up in. My dad passed away from cancer in 2007 when I was 14. I've spent a lot of time over the last year trying to sort through my emotions and feel more connected to him.

Now that I'm back in the suburbs — and out of NYC — for a while, I figured I would try to fix up his bike. I know very little about bikes, other than how to ride them so not sure what to expect. I think certain parts, like spokes, are expensive. Once the rain lets up, I'll take it out of the garage for an inspection.

Until then, I'm going to spend some time researching bikes. Found out that this one is a Fuji 10 speed and bookmarked this article to read tomorrow.

Switched from vim-yoink to YankRing. Originally I discounted YankRing because the project was so old and didn't have any recent commits, but it appears to work okay (famous last words).

The thing I like about it that vim-yoink doesn't have is it allows you to view the entire clipboard with the YRShow command (I mapped to <Leader>y) and select one of the yanks to paste.

I use Alfred's built in clipboard history manager to cycle through different things I've copied, but it didn't work well with Vim. Formatting was messed up and my system clipboard picked up some Vim operators I didn't care about (mostly x).

I could have spent more time configuring, but for now I decided to go with vim-yoink, which "automatically maintain[s] a history of yanks that you can choose between when pasting." It even works with the system clipboard!

When I was writing a blog post in Vim, I wanted to turn on spellcheck and change a few other settings so I learned that I could use an autocommand to apply settings based on the open file type.


autocmd FileType markdown setlocal signcolumn=no spell textwidth=80 colorcolumn=+1

I found myself wanting a way to run things on the command line while using Vim so I decided to try out tmux. Like Vim, I had come across tmux before, but never found it that useful.

Now, I almost exclusively run Vim in tmux. With the vim-tmux-navigator plugin, you can quickly jump between Vim splits and tmux panes too.

Typically I will use two tmux panes. One on the left running Vim and one on the right for executing build scripts or tests. It's nice coding and seeing the results nearby.

Vim has a powerful ecosystem of plugins that do almost anything. I wanted to carefully approach installing plugins when I first started so I didn't end up with too many. My goal was to make Vim a little more like the IDEs I'd grown used to since I started programming.

With that in mind, I installed a plugin manager, vim-plug, and added a few to try out. By far the most useful plugin is coc.vim. I mentioned coc before in the output on snippets a couple days ago. It also powers my autocomplete, formatting, etc.

A close second to coc is fzf.vim, which allows me to open files and search code. I extended it to include a nice preview using bat and search really quickly with ripgrep.

Not all Vim plugins adds functionality. My color scheme is also a plugin! I'm using jellybeans. Vim is infinitely configurable and you can often find a plugin to help make a task easier or faster.

The first day I started using Vim, I configured a bunch of basic settings that are mostly unchanged today.

They are the foundation of my vimrc. Simple things like showing line numbers (set number) and the current mode (set showmode), and converting tabs to spaces (set tabstop=4).

I also disabled the arrow keys to force me to use hjkl for everything. Here's what my vimrc looked like back then.

In the last output, I said the next few would focus on documenting everything I learned before I signed up for Futureland. I lied. I'm learning too much, too quickly. Instead they will be a mix of previous learning and new stuff.

Now for some new stuff. Snippets. coc.vim, the ["Intellisense engine"] I'm using, includes an extension for code snippets. I’ve always wanted to use  snippets to speed up development (by reducing the amount of code I need to write) but never wanted to invest time in building up a repository of them.

With coc-snippets, I can take advantage of existing third-party snippet definitions. I already added a couple: vim-es2015-snippets and vim-react-snippets that are speeding things up.

2

I'm a month or so into learning Vim so thought I would start documenting the journey. It's a shame I didn't start recording from the beginning — since I learned a lot — but here we are now. Over the next few days, I'll catch Futureland up to speed, using my Git commit history. Today, I thought I would talk more about the motivation for learning Vim and how I got started.

Vim is a text editor for efficiently creating or changing text. It's popped up every so often since I started programming, but I always dismissed it. After feeling bored with VS Code and seeing a coworker use Vim. I decided I would explore making the switch. I could try it for a week and retreat to the comfort of VS Code if it wasn't for me.

I started on February 25, 2020 with an article on configuring Vim to play nicely with JavaScript. I wanted to make sure I could get an autocomplete, linting, etc. going before committing. Next, I did a few videos a day from Thoughtbot's Onramp to Vim course. After about a week of watching videos, reading blog posts, and using Vim for programming every day, I was hooked.

I wish I started learning Vim 10 years ago! There are not many things I can say that about.

josephazar
I saw your comment throw my email, but n...
gndclouds
🌬 💧
tmm
Will check those out! Thanks!
internetvin
you're living right now man. Where ya at...
internetvin
Nice man. This is such a great journal. ...
lucas
Had the same experience so far. Seems to...
tmm
I’ll probably use it since it’s a pretty...
internetvin
A super great image and a beautiful day....
internetvin
I can say that Sam Harris' meditation co...
lucas
Valuable insights about accessibility. T...
tmm
@lucas can i disable previews? this is g...
internetvin
Really neat!
lucas
Hope I will get to this level soon. lol
lucas
Thanks for sharing. Tried it out in anot...
tmm
good idea - will try it out. also just r...
internetvin
Nice! I want to try this out soon. @luca...
lucas
Thank you for sharing. I find that very ...
abhi
Love the alliteration, why not have a la...
internetvin
My current set up is the Apple Notes app...
lucas
Cool that you write about why you starte...