{"id":290,"date":"2020-08-27T09:34:00","date_gmt":"2020-08-27T16:34:00","guid":{"rendered":"https:\/\/icanthascheezburger.com\/wordpress\/?p=290"},"modified":"2020-08-26T21:36:12","modified_gmt":"2020-08-27T04:36:12","slug":"building-custom-jigs-with-alfred","status":"publish","type":"post","link":"https:\/\/icanthascheezburger.com\/wordpress\/2020\/08\/building-custom-jigs-with-alfred\/","title":{"rendered":"Building Custom Jigs With Alfred"},"content":{"rendered":"<p><strong>note:<\/strong> I&#8217;m giving away some Alfred licenses!<\/p>\n<p>Because I love Alfred so darn much, I&#8217;m giving away Alfred Powerpack licenses to some lucky readers. If you want to enter, you should own a Mac, since you&#8217;ll need one to actually use Alfred!<\/p>\n<p>To enter, do one of the following:<\/p>\n<ul>\n<li>follow me at <a href=\"https:\/\/twitter.com\/@harpaa01\">@harpaa01<\/a><\/li>\n<li><a href=\"https:\/\/icanthascheezburger.com\/wordpress\/subscribe\/\">Subscribe<\/a> to icanthascheezburger via email<\/li>\n<li>Subscribe via RSS at the link above and leave a comment with your email address (I won&#8217;t publish the comment)<\/li>\n<\/ul>\n<p>If you also mention one of these posts on Twitter or Mastodon or Micro.blog and mention me you&#8217;ll double your chances.<\/p>\n<p>I&#8217;ll pick winners next Wednesday, September 2, 2020!<\/p>\n<hr>\n<p>I like to watch experienced craftspeople do woodworking from time to time, and the more I watch good ones doing their work, the more I realize it has a lot in common with software development as a craft.<\/p>\n<p>One such similarity is that woodworkers will often see opportunities to make themselves more productive by building little custom tools for themselves such as jigs to help hold a piece of wood in place, or to help make consistent cuts when doing some repetitive work.<\/p>\n<p>Here&#8217;s a common enough use case: I have a <code>projects<\/code> folder where I keep all my programming projects. I very commonly want to just open one of the folders in that <code>projects<\/code> folder with my editor of choice.<\/p>\n<p>Alone, Alfred makes this not too difficult:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/icanthascheezburger.com\/wordpress\/wp-content\/uploads\/2020\/08\/CleanShot-2020-08-26-at-21.11.28.gif\" alt=\"alfred accessing a project folder\" title=\"CleanShot 2020-08-26 at 21.11.28.gif\" border=\"0\" width=\"298\" height=\"199\"><\/p>\n<p>That isn&#8217;t bad.<\/p>\n<p>But we can do it faster with a workflow.<\/p>\n<p>This workflow has two components: a <em>script filter<\/em> input and an action that runs a script.<\/p>\n<p>This is the script filter:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/icanthascheezburger.com\/wordpress\/wp-content\/uploads\/2020\/08\/CleanShot-2020-08-26-at-21.18.47@2x.png\" alt=\"script filter\" title=\"CleanShot 2020-08-26 at 21.18.47@2x.png\" border=\"0\" width=\"299\" height=\"245\"><\/p>\n<p>The code for the script filter:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/aharpole\/17cbf5dea3526c670529749f3d3b29f9.js\"><\/script><\/p>\n<p>I&#8217;m not that good at Bash scripting and I lifted this code from some other Alfred workflow years ago. But to customize it, you&#8217;ll want to change the directory where it says <code>cd ~\/projects<\/code> to match the directory you keep your projects in. You can also customize the text to say whichever editor you plan to have projects open in.<\/p>\n<p>The action script is set up like so:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/icanthascheezburger.com\/wordpress\/wp-content\/uploads\/2020\/08\/CleanShot-2020-08-26-at-21.21.52@2x.png\" alt=\"script action\" title=\"CleanShot 2020-08-26 at 21.21.52@2x.png\" border=\"0\" width=\"299\" height=\"221\"><\/p>\n<p>The script reads simply <code>\/usr\/local\/bin\/mate ~\/projects\/{query}<\/code>. Your editor will be a different binary. If you use VS Code and you&#8217;ve set it up to <a href=\"https:\/\/code.visualstudio.com\/docs\/setup\/mac\">launch from the command line<\/a> the path to the binary will be <code>\/usr\/local\/bin\/code<\/code> instead.<\/p>\n<p>With everything set up, let&#8217;s see how it looks:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/icanthascheezburger.com\/wordpress\/wp-content\/uploads\/2020\/08\/CleanShot-2020-08-26-at-21.26.02.gif\" alt=\"alfred script filter workflow in action\" title=\"CleanShot 2020-08-26 at 21.26.02.gif\" border=\"0\" width=\"300\" height=\"177\"><\/p>\n<p>Not bad!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>note: I&#8217;m giving away some Alfred licenses! Because I love Alfred so darn much, I&#8217;m giving away Alfred Powerpack licenses to some lucky readers. If you want to enter, you should own a Mac, since you&#8217;ll need one to actually use Alfred! To enter, do one of the following: follow me at @harpaa01 Subscribe to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","jetpack_publicize_message":"Building Custom Jigs With @AlfredApp (also: win a free Alfred PowerPack!)","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[1],"tags":[21],"class_list":["post-290","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-alfred"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/icanthascheezburger.com\/wordpress\/wp-json\/wp\/v2\/posts\/290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icanthascheezburger.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icanthascheezburger.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icanthascheezburger.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/icanthascheezburger.com\/wordpress\/wp-json\/wp\/v2\/comments?post=290"}],"version-history":[{"count":0,"href":"https:\/\/icanthascheezburger.com\/wordpress\/wp-json\/wp\/v2\/posts\/290\/revisions"}],"wp:attachment":[{"href":"https:\/\/icanthascheezburger.com\/wordpress\/wp-json\/wp\/v2\/media?parent=290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icanthascheezburger.com\/wordpress\/wp-json\/wp\/v2\/categories?post=290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icanthascheezburger.com\/wordpress\/wp-json\/wp\/v2\/tags?post=290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}