Skip to content

Instantly share code, notes, and snippets.

View example.rb
# this is similar to lisp, implicit return is super natural
def this_is_expressive(arg)
if arg
query_one(arg)
else
query_two(arg)
end
end
View hack.el
(defun lsp--on-diagnostics (workspace params)
"Callback for textDocument/publishDiagnostics.
interface PublishDiagnosticsParams {
uri: string;
diagnostics: Diagnostic[];
}
PARAMS contains the diagnostics data.
WORKSPACE is the workspace that contains the diagnostics."
(let* ((file (lsp--uri-to-path (gethash "uri" params)))
(diagnostics (seq-map #'lsp--make-diag (gethash "diagnostics" params)))
View arch.org

Arch

Arch Install Script

partition drive

  • view drives: fdisk -l
  • gdisk <drive>
  • d (delete) all
  • efi: n, <default> - +512M, EFI
  • root: n, <default> - -0, Linux Filesystem
  • w (write and save)
View tab.vim
vmap <TAB> <esc>mbgv=`bgv
nmap <TAB> mb==`b
imap <TAB> <C-R>=HandleITab()<cr>
func! HandleITab()
if pumvisible()
return "\<c-n>"
else
return "\<ESC>==i"
endif
View coc-settings.json
{
"languageserver": {
"golang": {
"command": "gopls",
"rootPatterns": ["go.mod"],
"filetypes": ["go"]
},
"dockerfile": {
"command": "docker-langserver",
View git.vim
nmap <leader>gg :Gstatus<cr>
nmap <leader>gb :Gblame<cr>
nmap <leader>gr :Grebase<cr>
nmap <leader>gp :Gpush<cr>
nmap <leader>gu :Gpull<cr>
nmap <leader>gw :Gbrowse<cr>
vmap <leader>gw :Gbrowse<cr>
nmap <leader>gb :Merginal<cr>
" gist
View plugins.vim
if &compatible
set nocompatible " Be iMproved
endif
call plug#begin('~/nvim/plugged')
" syntax
Plug 'othree/yajs.vim'
Plug 'othree/html5.vim'
Plug 'vim-scripts/nginx.vim'
@mbriggs
mbriggs / fixture.rb
Created Dec 12, 2018
Take 2 on handler fixtures
View fixture.rb
require_relative "../../automated_init"
context "Handle Commands" do
context "Added" do
context "Writes Added event" do
id = Controls::Account.id
account = Controls::Account::New.example
add = Controls::Commands::Add.example
time = Controls::Time::Processed.example
View event_written.rb
module Fixtures
class EventWritten
include TestBench::Fixture
attr_accessor :stream_name
attr_accessor :values
attr_accessor :command
attr_accessor :expected_version
attr_accessor :command_attributes
View redis.ex
defmodule Autobot.Redis do
import Exredis
def start_link do
Agent.start_link(fn ->
{:ok, client} = Exredis.start_link
client
end, name: __MODULE__)
end
You can’t perform that action at this time.