A software engineer with a penchant for working with Web Platform features and hacking on small projects has created posts and notes on this website.
Posts
- Web Performance — From the Lab to the Field In this post, I delve into the world of web performance and its profound influence on user experience. I share my experiences of optimizing my website, koddsson.com, by using real user monitoring and tools like Lighthouse CI.
- Implementing View Transitions on koddsson.com How I implemented MPA View Transitions on koddsson.com
- Stop trying to make things perfect A blog post with some thoughts on perfectionism
- Emojis as favicons A blog post describing how to use JavaScript to quickly set a websites favicon to a emoji
Images
Notes
-
Since bookmarks can be JavaScript we can dynamically create a URL based on some data. In this case the data is the current date. We'll use that to create a GitHub search filter for pull requests created in the last 7 days.
const today = new Date(); const lastWeek = new Date(new Date().setDate(new Date().getDate() - 7));
const created = [ [lastWeek.getFullYear(), lastWeek.getUTCMonth() + 1, lastWeek.getDate()].join("-"), [today.getFullYear(), today.getUTCMonth() + 1, today.getDate()].join("-"), ].join("..");
const url = new URL("https://github.com/pulls"); const params = new URLSearchParams();
params.set( "q", 'is:pr author:@me is:closed created:' + created );
url.search = params.toString();
window.location.href = url.toString();
Then we just need to compress the JavaScript, URL encode it, stick the
javascript:
protocol in front of the script and stick it in a URL. You can drag that into your bookmarks bar and now you have a easy shortcut to the work you did last week, ready for your next Monday standup!Note that you'll need to update user name (author:koddsson
) in the original script and then recreate the bookmarklet again to get your pull requests. I used https://caiorss.github.io/bookmarklet-maker/ to create my bookmarklet.Edits:
2024/10/21: @carlocab_ pointed out that I can use
author:@me
instead of hard-coding a username in the script. -
I'm excited about working on some Web Performance "lab monitoring" at work but the initial runs are not great. Hoping that there are easy fixes that get us to be a lot more performant.
-
I got a dog about a week ago. His name is Tofu.