Skip to content

Instantly share code, notes, and snippets.

@josephholsten
josephholsten / highlight-names.md
Last active November 10, 2023 19:31
Tree Sitter Highlight Classes

I've noticed that some of the themes in helix are using undocumented highlight selectors. Well that's no surprise, these are comming from highlight.scm files in tree-sitter grammars, while the least terrible reference to these classes seems to be https://docs.helix-editor.com/themes.html

We can do better. So first I'm going to just start collecting notes from existing grammars. Two main things will be here: references to "standard" classes, and also guidance for how to change "non-standard" classes.

Standard

Current doc source: https://github.com/helix-editor/helix/blob/master/book/src/themes.md

  • attribute - Class attributes, HTML tag attributes
#!/bin/sh
die()
{
[ $# -eq 0 ] && exit 1
[ $# -gt 1 ] && \
echo "error initiated at line $1 :
$2" 1>&2 || \
echo "$1" 1>&2
#cloud-config
write_files:
- path: /etc/cinc/client.rb
permissions: '0644'
owner: root:root
content: |
chef_server_url "${chef_server_url}"
- path: /etc/cinc/validation.pem
permissions: '0644'
@josephholsten
josephholsten / sizeup.lua
Last active June 4, 2022 11:41
SizeUp in Hammerspoon
-- === sizeup ===
--
-- SizeUp emulation for hammerspoon
--
-- To use, you can tweak the key bindings and the margins
local sizeup = { }
--------------
-- Bindings --
@josephholsten
josephholsten / json-log.conf
Created January 22, 2015 01:12
Complete JSON nginx log_format
# json-log.conf - log all useful nginx variables in json formatted log
# for details about these variables, see http://nginx.org/en/docs/http/ngx_http_core_module.html#variables
log_format json-log '{'
# $arg_*
# $args
# $binary_remote_addr
'"body_bytes_sent":"$body_bytes_sent",'
'"bytes_sent":"$bytes_sent",'
'"connection":"$connection",'
# $connection_requests
@josephholsten
josephholsten / fib.js
Created July 21, 2017 08:10
Fibonacci for Webtask.io
var request = require('request')
// Fib takes an integer from the query param q, recursively calculates the fibonacci function and returns its value
var Fib = function (context, callback) {
// apiURI should be set to the URI for this webtask
var api = context.secrets.apiURI
// fib(x) is provided by the query param "q"
var x = parseInt(context.data.q)
switch (x) {
case 0:
@josephholsten
josephholsten / check-http-json.rb
Created January 4, 2016 06:53
Simplest HTTP+JSON sensu plugin
#! /usr/bin/env ruby
# check-simple-http-json - show how to check a url, grab its json, and
require 'sensu-plugin/check/cli'
require 'json'
require 'net/http'
require 'uri'
class CheckSimpleHttpJson < Sensu::Plugin::Check::CLI
option :url,
@josephholsten
josephholsten / fasd-fzf.sh
Last active June 21, 2017 22:54
fasd with fzf for interactive selection
# same default aliases as fasd, but with fzf(1) for interactive selection
# fzf(1)
export FZF_DEFAULT_COMMAND='ag -g ""'
FZF_PATH="/usr/local/opt/fzf"
if [ -f "$COMPLETION_PATH" ]; then
source "$FZF_PATH/shell/completion.bash"
source "$FZF_PATH/shell/key-bindings.bash"
fi
@josephholsten
josephholsten / gist:cea0f01d9d571065c5b8
Created June 18, 2015 23:30
terraform-repo-layout
README.md
scripts/bootstrap
_shared/cloud-init-template.sh
common_variables.tf.json
modules/reporting_hadoop/gateway.tf.json
modules/reporting_hadoop/main.tf.json
modules/reporting_hadoop/manager.tf.json
modules/reporting_hadoop/master.tf.json
modules/reporting_hadoop/slaves.tf.json
class Chef::Node
# dig takes a node or databag and traverses through node/hash attributes according to the provided path
# databagitem.dig('this.attribute.here')
def dig(path, default=nil)
# works fine in chef 10
path.split(".").inject(self) do |l,k|
if l.respond_to?(:keys)
(l.to_hash[k] || l.to_hash[k.to_sym] || default)
else
default