Page 1 of 59

#JavaScript, #Mood

Current Mood

This is an old one, but it sure described my day about 5 years ago.

And of course, the code I wasted some time writing to get this ridiculous result.

function howIFeelToday() {
    var d = new Date(),
      h  = d.getHours(),
      hh = (h > 12 ? h - 12 : h),
      m = (d.getMinutes()10?'0':'') + d.getMinutes(),
      a = h  12 ? ' AM' : ' PM',
      time = hh + ':' + m + a,
      feeling = "";

    switch(h) {
        case 8:
        case 9:
        case 10:
        case 11:
            feeling = "Damn, it's only " + time + "!";
        case 12:
            feeling = time + ", yeah, lunch time!";
        case 13:
        case 14:
        case 15:
        case 16:
            feeling = time + "...this is the longest day of my entire ever-loving life...";
        case 17:
            feeling = time + "! Finally. :)";
            feeling = "Probably not at work.";
    return feeling;

var currentmood = howIFeelToday();

#CSS, #Responsive Design

Fluid Type for Better Responsive Text

I’ve been playing around with fluid type for a while and happened upon a pen by…I don’t remember who. I forked it a while ago, but in essence we’re simply attempting to scale type based on viewport size.

In the instance highlighted here, let’s say we want a bold header in a hero space to essentially always have that bold feel no matter what screen size we’re viewing items at:

See the Pen Scaling Text with Viewport Units by mikemattner (@mikemattner) on CodePen.

Not a bad solution, but if you’re not careful that can scale infinitely and in a way that is just a bit too in your face. My suggestion is to set–at the very least–an upper bound to that scaling. I’ve done something similar on this very site.

My minimum size is set at 14px, plus a half a percent of the viewport width with a line-height set based on 1.1em plus a half a percent of the viewport width. This will scale up infinitely, but I found that that maximum font-size I wanted was closer to 20px. Through a little viewport resizing and code inspection, I found the viewport width where this formula would generate a nominal 20px size and set that as my upper bound:

html {
  font-size: calc(14px + 0.5vw);
  line-height: calc(1.1em + 0.5vw);
  @media (min-width: 1200px) {
        font-size: 20px;

Not too bad of a result as far as I can tell. The rest of my typographic sizing builds on this initial sizing and seems to work out fairly well for my purposes.

Easy technique.

#Development, #Dotfiles

Adventures in Dotfiles

I accidentally ran into a bit of laziness during my development process that turned into a productivity boon, and should prove to be absolutely essential during the setup of any new Mac I might purchase in the future.

Let me preface this by saying I am not a native of the command line–by any stretch. I find it to be cumbersome and annoying to remember commands and all of the possible flags that might apply to them. Even something as simple as showing hidden files on the Mac can be obnoxious:

# Show hidden files
--- ~ » defaults write AppleShowAllFiles -bool true && killall Finder

# Hide hidden files
--- ~ » defaults write AppleShowAllFiles -bool false && killall Finder

What if I could just type show or hide and be done with it? This is where aliases come in. This was a concept I was keenly aware of already–seeing that most of the helper plugins I used in my ZSH installation provide plenty of helpful aliases–but I figured, why not create some that I could use for operations I performed frequently? Or to find a way to easily navigate to directories I regularly used?

At first I created a simple .aliases file and started to add what I needed:

# Show/hide hidden files in Finder
alias show="defaults write AppleShowAllFiles -bool true && killall Finder"
alias hide="defaults write AppleShowAllFiles -bool false && killall Finder"

# Hide/show all desktop icons (useful when presenting)
alias hidedesktop="defaults write CreateDesktop -bool false && killall Finder"
alias showdesktop="defaults write CreateDesktop -bool true && killall Finder"

# Disable Spotlight
alias spotoff="sudo mdutil -a -i off"
# Enable Spotlight
alias spoton="sudo mdutil -a -i on"

#Git commands
alias gnb="git checkout -b"
alias gmsg="git commit -m"

I sourced it in my .zshrc file and called it good.

But then I wondered what would happen if I lost everything on this system? I started doing a little research and discovered that there were plenty of people working on ways to bootstrap their development environments for situations like this.1

I found one particular repo by Mathias that I was able to gather some items from, as well as an installation process that could get me started with everything I used. Now all I need to do is navigate to my cloned repo and type:

--- ~ » source

I follow a few prompts and install what I need to get up and running. I can share my dev environment between machines fairly easily this way.

If you’re interested, feel free to browse my repo for reference, or fork it if you want to build on it. Keep in mind, there are more repos available with more sophisticated setups than my own if you’re looking for something more robust, but if you’re knew to this level of customization on this level, this is a good start.2

View Project on GitHub

  1. Getting Started with Dotfiles. Accessed May 23, 2018.
  2. GitHub does dotfiles. Accessed May 23, 2018.


The things that you put inside your head are like lego blocks. If you are trying to build with just with one shape and one colour your creations will always be limited. The more blocks you have and the more diverse their shapes and colours, the more interesting castles you can build.

Maria Popova

Via Swiss Miss.


Rules to Live By

These are from John Perry Barlow, but what a fine, fine list this is.

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
  9. Concern yourself with what is right rather than who is right.
  10. Never forget that, no matter how certain, you might be wrong.
  11. Give up blood sports.
  12. Remember that your life belongs to others as well. Don’t risk it frivolously.
  13. Never lie to anyone for any reason. (Lies of omission are sometimes exempt.)
  14. Learn the needs of those around you and respect them.
  15. Avoid the pursuit of happiness. Seek to define your mission and pursue that.
  16. Reduce your use of the first personal pronoun.
  17. Praise at least as often as you disparage.
  18. Admit your errors freely and soon.
  19. Become less suspicious of joy.
  20. Understand humility.
  21. Remember that love forgives everything.
  22. Foster dignity.
  23. Live memorably.
  24. Love yourself.
  25. Endure.

Sourced from the article A list of 25 Principles of Adult Behavior by John Perry Barlow from the venerable Kottke.


Whenever someone has done wrong by you, immediately consider what notion of good or evil they had in doing it. For when you see that, you’ll feel compassion, instead of astonishment or rage. For you may yourself have the same notions of good and evil, or similar ones, in which case you’ll make an allowance for what they’ve done. But if you no longer hold the same notions, you’ll be more readily gracious for their error.

Marcus Aurelius

Hat tip to lifehacker.

#Politics, #Republicans

It becomes ever harder to disagree with the verdict of foreign-policy sage Robert Kagan, like me an erstwhile Republican, who writes that the GOP in its current form is doomed and that Republicans who cannot stomach Trumpism “should change their registration and start voting for Democratic moderates and centrists, as some Republicans did in Virginia recently, to give them a leg up in their fight against the party’s left wing.” As I’ve explained before, I have my qualms about the Democratic Party, which is lurching to the left, but I am done, done, done with the GOP after more than 30 years as a loyal Republican.

Max Boot, Republicans Have Stockholm Syndrome, and It’s Getting Worse