Skip to content

Instantly share code, notes, and snippets.

Avatar
💥
breaking things

Ilia Choly icholy

💥
breaking things
View GitHub Profile
View lsptest.go
package main
import (
"context"
"encoding/json"
"io"
"log"
"os"
"os/exec"
"path/filepath"
@icholy
icholy / nvim_lsp_status_airline.lua
Last active January 3, 2022 18:52
TypeScript LSP status in Airline
View nvim_lsp_status_airline.lua
-- The TypeScript LSP server takes a while before it's responsive. This is a janky way of indicating the server status in
-- airline. It works by adding "..." to the statusline when the LSP connects, and then removing the "..." when the first
-- set of diagnostics come in.
vim.cmd([[
let g:lsp_wait_added = 0
let g:lsp_wait_done = 0
function! LspWait(...)
let builder = a:1
let context = a:2
View merged.json
{
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"https"
],
View skipto.go
package bufutil
import (
"bufio"
"bytes"
)
// SkipTo finds the first instance of delim and discards everything before it.
func SkipTo(br *bufio.Reader, delim []byte) (err error) {
min := len(delim)
View tic_tac_toe.go
package main
import (
"fmt"
"math"
"strings"
)
func main() {
g := Game{
View go_variadic_param.md
package main

//go:noinline
func thing(values ...string) {
	for _, v := range values {
		println(v)
	}
}
@icholy
icholy / shift.go
Last active January 8, 2021 17:06
View shift.go
package binutil
// ShiftLeft performs a left bit shift operation on the provided bytes.
// If the bits count is negative, a right bit shift is performed.
func ShiftLeft(data []byte, bits int) {
n := len(data)
if bits < 0 {
bits = -bits
for i := n - 1; i > 0; i-- {
data[i] = data[i-1]<<(8-bits) | data[i]>>bits
View context_util.go
package contextutil
import (
"context"
"time"
)
// ResetFunc resets the context timeout timer
type ResetFunc func()
View versions.go
package main
import (
"errors"
"fmt"
"io"
"log"
"net/http"
"os"
View rolling_plot_xy.go
package rolling
import "gonum.org/v1/plot/plotter"
type XYs struct {
size int
start int
length int
data plotter.XYs
}