Completion types:
- Internal commands and subcommands
- External commands
- Files (executable)
Location(s):
import { makeAutoObservable, makeObservable, observable } from "mobx"; | |
import { DataModel, Model, model, prop } from "mobx-keystone"; | |
import { types } from "mobx-state-tree"; | |
function bench(f: () => { value: number }) { | |
// Warmup | |
let sum = 0; | |
for (let index = 0; index < 100_000; ++index) { | |
sum += f().value; | |
} |
import { Event, Suite } from "benchmark"; | |
import * as ejs from "ejs"; | |
import * as handlebars from "handlebars"; | |
import * as nunjucks from "nunjucks"; | |
const DATA = { | |
greeting: "Hello", | |
things: [ | |
{ name: "Test", color: "red" }, | |
{ name: "Boat", color: "blue" }, |
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
# | |
# Output a grouping of methods (within a file) such that for each group G, and any method m ∈ G: | |
# - ∃ x ∈ G such that x calls m, or | |
# - no other method in all groups calls m | |
# | |
# The output is a kind of "function cohesion", where you can find groups of methods that are related. | |
# This is useful when trying to find what you need to extract from a file. |
#!/bin/zsh | |
function main { | |
if [[ ! "$1" =~ ".*:.*" ]]; then | |
echo "Empty username or branch name: \`$1\` should be of the form \`user:branch\`" | |
exit 1 | |
fi | |
local username="${1%:*}" | |
local branch="${1#*:}" |
#!/usr/bin/env ruby | |
require "flog" | |
require "open3" | |
def capture_output(cmd, *args) | |
stdout, stderr, status = Open3.capture3(cmd, *args) | |
return stdout if status.success? | |
STDERR.puts("Failed to run git #{args.join(" ")}") |
#!/usr/bin/ruby --disable-gems | |
# | |
# # Prerequisites | |
# | |
# # Example usage | |
# | |
# find_cohesive_changes <file> | |
# | |
require "open3" |
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require "csv" | |
require "set" | |
begin | |
require "erubi" | |
rescue LoadError | |
end |
#!/usr/bin/ruby --disable-gems | |
# | |
# # Prerequisites | |
# | |
# - ghostscript | |
# - graphviz | |
# | |
# # Example usage | |
# | |
# graph_mutual_changes --clustering=package --since="6 months ago" && open graph.pdf |
#!/bin/bash | |
profile-curl() { | |
local num_iters=500 | |
local num_warmups=10 | |
local -a times | |
for x in $(seq 1 "${num_warmups}"); do | |
curl -s -o /dev/null "$@" 2>&1 | |
done |