I updated my micro.blog theme to use @ka’s excellent “Kiko: System Theme”, with a couple tweaks.
(thanks @ka for sharing!)
I updated my micro.blog theme to use @ka’s excellent “Kiko: System Theme”, with a couple tweaks.
(thanks @ka for sharing!)
I recently started using Day One and think it’ll be a keeper for me. I use it like a “family blog”, posting pictures of the kids and things we’ve doing.
Back in August, I wrote about how I was starting to learn Emacs. I had planned to post weekly updates as I was learning, but life happened and I didn’t end up doing that. So from now on, I’ll just be numbering these posts with #1
, #2
, etc.
On the bright side, I’ve still been learning! Since the last post, I’ve:
~/.emacs
file with some packages.I’ve been a vim user (occasionaly full time) for a several years, but I intentionally avoided evil-mode when I was getting started with Emacs. I wanted to learn the standard Emacs shortcuts first, before trying anything else.
Once I felt pretty confident with vanilla-emacs though, I was ready to get back some of that vim-awesomeness.
A quick google search turned up this talk and post by Aaron Bieber, both of which were great to help me get going.
Once I got everything setup, I instantly felt at home with evil-mode. I still had access to M-x function
and all the Emacs modes I had learned, but now there was a nice layer of vim on top. Like icing on a cake! 🍰
I also setup evil-leader, and bound it to ,
, to emulate my vim leader key.
Aquamacs had been serving me really while I was learning the ropes, but it was time to switch to something more standard. I’m on macOS, so I went with the homebrew cask version of emacs:
brew cask install emacs
Now that I needed to install and configure plugins, I figured it was time to setup my ~/.emacs
file.
In Aaron Bieber’s post he recommends use-package for auto-installing packages. It sounded similar to how I was using Vundle in vim, so I went with that.
Once I had use-package installed, I added in a couple of packages like powerline and markdown-mode to try it out.
I also added my ~/.emacs
file to my dotfiles on GitHub, because open-source! 🎉
Now that I can install fancy packages, I added Dracula theme for some pretty colors. I also really like having powerline in the bottom.
I’m late writing my next emacs post, but I’ve been trying out lots of new things! I starting using the homebrew version of emacs and evil-mode, and it’s been great! Hoping to write it up soon.
I started learning Emacs last week!
I’m not using it full-time just yet, for now I’m studying it own its own, and using it for small tasks while I learn the basics.
I decided to keep weekly notes (using Emacs of course!) of the things I learn along the way.
caps-lock
and return
to left and right ctrl
using this modifier.C-h t
).C-h
are really helpful when I forget a shortcut.C-n
and
C-p
to navigate up/down menu items! Nifty! 🎉⌘+s
and ⌘+w
, which comes in handy (though I try not to use them).Nothing fancy yet. Pretty much just the out-of-box Aquamacs.
🎙️ A couple of podcasts I’ve recently discovered and been enjoying a lot:
Fellow micro.blog-er @kaa, on writing for yourself:
While it’s easy to fall into the trap of thinking that you’re writing on your website for the ‘internet’, the truth of the matter is that you’re actually writing these things and obsessing about it’s design primarily and sometimes exclusively for yourself.
I fall into this trap a lot. I’ll get a new idea for something I want to write about, then come the little voices.
No one cares about this.
Surely someone out there has already written about this.
You’re probably going to get something wrong anyways.
Somehow knowing that people might read what I write, and that it might not be very good, keeps me from writing altogether.
Getting into micro.blog has actually helped me a lot with this. I’ve found small, title-less posts, are somehow easier for me to write than regular posts. Maybe because they are less “official” feeling, and therefore less likely to be judged like a piece of writing.
I hope I can put Khaled’s words into practice and focus on writing more for myself.
Been working on some updates to the blog!
📚 Finished reading Ben Horowitz’s “The Hard Thing About Hard Things.” Great book! Putting it on my top things list too.
Edit for iOS is the perfect little app for writing micro.blog posts! 👌
1) Write a quick note 💭✏️
2) Close app
3) Think about it ☕️⏱
4) Re-open later
5) Tweak and post! 🎉
Fact Snack
“I18n” (short for internationalization) came from “the letter i, followed by 18 letters, followed by n”. 🌐 – (Source)
The HackerRank puzzle I did this morning was a lot of fun, so I thought I’d share!
The puzzle was to create a “staircase” output where you’re given a number (let’s say 6
), and should produce an output like this:
#
##
###
####
#####
######
The output should have an increasing number of right-aligned hashes #
, up to the number given (so 6 lines in this case).
Here’s the final solution I came up with in Ruby:
def staircase(n)
arr = (0...n).to_a.reverse.map do |i|
arr = Array.new(n, "#")
arr.fill(" ", 0...i)
arr.join
end
puts arr.join("\n")
end
My basic idea was to create an array of chars for each line of the output, so the third line would be:
[" "," "," ","#","#","#"]
This led to discover the fill
method, which sets a range of array elements to a new value (fancy 🥂!).
Since I wanted to each line’s array to have an increasing number of hashes at the end of the array, I decided to map over an array of decreasing numbers based on the input:
(0...6).to_a.reverse #=> [5,4,3,2,1]
This allowed me to create a fully-filled array in each loop, and zero-out the front of array based on the current number:
arr = Array.new(6, "#") #=> ["#","#","#","#","#","#"]
arr.fill(" ", 0...3) #=> [" "," "," ","#","#","#"]
All that’s left then is to join
each sub-array, and then join("\n")
final array to get the staircase!
I’ve been doing some of these smaller puzzles each day before any of my “big” work, and I’ve really enjoyed it. It’s a great way to have fun and try weird/new ideas.
I’ve been putting together a list of my favorite movies, books, games, and other stuff (just for fun!). Added links to all the things tonight.
So proud to see my better half graduate this weekend! And somehow she did it all while being a super-mom of 2!
Stack Overflow for Teams looks amazing! I have a hunch this will be the tool that finally solves the “institutional knowledge” problem.
Playing Causality tonight — it gets my 👍! The time-puzzles are fun, and I really like the vibrant colors.
The new “smart resume” feature in Overcast 4.1 is really nice! Used it with Waze’s turn-by-turn directions the other day and it worked great.
Had so much fun with PikoPixel last night, I drew this little ninja guy tonight. Hoping to try some animations soon.
Tinkered around a bit with PikoPixel tonight! I’m not much of an artist, but I still had fun drawing these cubes.
I learned something new about the pry
tool today, after reading this post from John Mair (the creator of pry).
You can use the show-method
command to lookup the source code to Ruby’s standard library methods:
[1] pry(main)> require 'uri'
[2] pry(main)> show-method URI::HTTP#request_uri
From: /Users/stevenschobert/.asdf/installs/ruby/2.4.2/lib/ruby/2.4.0/uri/http.rb @ line 102:
Owner: URI::HTTP
Visibility: public
Number of lines: 6
def request_uri
return unless @path
url = @query ? "#@path?#@query" : @path.dup
url.start_with?(?/.freeze) ? url : ?/ + url
end
This also works for methods implemented in C:
[3] pry(main)> show-method String#chomp
From: string.c (C Method):
Owner: String
Visibility: public
Number of lines: 7
static VALUE
rb_str_chomp(int argc, VALUE *argv, VALUE str)
{
VALUE rs = chomp_rs(argc, argv);
if (NIL_P(rs)) return rb_str_dup(str);
return rb_str_subseq(str, 0, chompped_length(str, rs));
}
In the example above, it’s hard to get a good idea of what String#chomp
is doing, because most of the work happens in the chomp_rs
function. Thanks to a recent addition, you can now lookup these functions in Pry as well:
[4] pry(main)> show-source chomp_rs
From: /Users/stevenschobert/.pry.d/ruby-2_4_2/string.c @ line 8122:
Number of implementations: 1
Number of lines: 13
static VALUE
chomp_rs(int argc, const VALUE *argv)
{
rb_check_arity(argc, 0, 1);
if (argc > 0) {
VALUE rs = argv[0];
if (!NIL_P(rs)) StringValue(rs);
return rs;
}
else {
return rb_rs;
}
}
Another handy command is the show-doc
command, which will show documentation for the method:
[5] pry(main)> show-doc Time.now
From: time.c (C Method):
Owner: #<Class:Time>
Visibility: public
Signature: now()
Number of lines: 4
Creates a new Time object for the current time.
This is same as Time.new without arguments.
Time.now #=> 2009-06-24 12:39:54 +0900
Note: Both the show-doc
and show-method
commands require the have pry-doc
add-on gem installed:
gem install pry-doc
I’m a heavy Dash user, so I typically use that to lookup docs/source code when working in Ruby. But having access to them in pry
is definitely going to come in handy for cases when I don’t have direct access to Dash. Dash also can’t lookup the internal C methods like chomp_rs
like Pry now can.
UPDATE: I had originally written that the C support to the show-method
command was new until John Mair kindly corrected me. What’s new is seeing C functions that don’t directly map to Ruby methods, like chomp_rs
.