jq is useful to slice, filter, map and transform structured json data.
brew install jq
# config/initializers/phlex_template_handler.rb | |
require "action_view" | |
require "phlex" | |
# Intercept unknown "capitalized" method calls (e.g., PageView(...)) in templates, | |
# look up a Phlex component class, instantiate it, and render it. | |
# Crucially, we re-bind the user’s block so that `self` is the component, not the ActionView context. | |
module PhlexDynamicMethodCalls | |
def method_missing(name, *args, **kwargs, &block) | |
# Only intercept method calls starting with an uppercase letter (e.g. "PageView", "MyComponent", etc.) |
from collections import OrderedDict | |
# >>> import cache_dict | |
# >>> c = cache_dict.CacheDict(cache_len=2) | |
# >>> c[1] = 1 | |
# >>> c[2] = 2 | |
# >>> c[3] = 3 | |
# >>> c | |
# CacheDict([(2, 2), (3, 3)]) | |
# >>> c[2] |
rubocop -a `git diff --name-only --cached | grep '\.rb'` |
Deploying a Phoenix app to Fly.io is a breeze...is what everyone kept telling me. In fairness, I imagine the process would have been breezier had I just used postgres, but all the sqlite and litestream talk has been far too intriguing to ignore. "Wait", you say. "It is just a flat file. How much harder can it be?"
It is easy to make something harder than it should be. It is hard to take something complex and make it truly simple. flyctl launch
does an amazing job at providing a simple interface to the utterly complex task of generating deployment resources, especially now that we are living in a containerd
(erm, firecracker) world.
This gist is for anyone who, like me, thinks they know better than to read all of the documentation and therefore necessari
So I have been using tmux for a while and have grown to like it and have since added many many customizations to it. Now once you start getting the hang of it, you'll naturally want to do more with the tool.
Now tmux has a concept of window-group
and session
and if you are like me you'll want multiple session that connects to the same window group instead of a new window group every time. Basically I just need different views into the same set of windows that I have already created, I don't want to create a new set of windows every time I fire up my terminal.
This is the default case if you simply use the tmux
command as your login shell, effectively creating a new group of windows every time you start tmux
.
This is less than ideal because, if you are like me, you fire up one-off terminals all the time and you don't want all those one-off jobs to stay running in the background. Plus sometimes you need information fro
substitutions: | |
# Phases of the Voice Assistant | |
# The voice assistant is ready to be triggered by a wake word | |
voice_assist_idle_phase_id: '1' | |
# The voice assistant is waiting for a voice command (after being triggered by the wake word) | |
voice_assist_waiting_for_command_phase_id: '2' | |
# The voice assistant is listening for a voice command | |
voice_assist_listening_for_command_phase_id: '3' | |
# The voice assistant is currently processing the command | |
voice_assist_thinking_phase_id: '4' |
Watch the breakdown here in a Q4 2024 prompt engineering update video
(function () { | |
const headers = $response.headers; | |
for (let key in headers) { | |
if (key.toUpperCase() === 'CONTENT-TYPE' && !headers[key].includes('text/html')) { | |
$done({}); | |
return; | |
} | |
if (key.toUpperCase() === 'CONTENT-SECURITY-POLICY') { | |
delete headers[key]; |