Skip to content

Instantly share code, notes, and snippets.

@timjstewart
timjstewart / window-setup.el
Last active September 27, 2022 15:54
Organize Emacs windows
(defun tjs/configure-dired ()
(dired-hide-details-mode 1))
(defun tjs/major-mode-equals (buffer major-mode)
(message (format "Testing buffer: %s" buffer))
(let ((result (equal major-mode (tjs/buffer-major-mode buffer))))
(message (if result
(format "Mode match: %s" major-mode)
(format "No Mode match: %s" major-mode)))
result))
@timjstewart
timjstewart / spacemacs.md
Created March 24, 2022 03:10
Spacemacs Keys

Spacemacs Features To Add to My Workflow

Dedicating Buffers/Windows

Window to Buffer

Press SPC w t to dedicate the current window to the current buffer. This is helpful when you have an important buffer that you don't want to get replaced by another buffer.

To dedicate a window to its Purpose

¡ !I 0xa1 161 INVERTED EXCLAMATION MARK
¢ Ct 0xa2 162 CENT SIGN
£ Pd 0xa3 163 POUND SIGN
¤ Cu 0xa4 164 CURRENCY SIGN
¥ Ye 0xa5 165 YEN SIGN
¦ BB 0xa6 166 BROKEN BAR
§ SE 0xa7 167 SECTION SIGN
¨ ': 0xa8 168 DIAERESIS
© Co 0xa9 169 COPYRIGHT SIGN
ª -a 0xaa 170 FEMININE ORDINAL INDICATOR
function! ReplaceMagicWithConstant(Arg, Start, Stop)
let constantName = input("Enter Constant Name: ")
call append(line("'<") - 1, printf("%s = %s", l:constantName, a:Arg))
execute printf("'<, '>s/%s/%s/gc", a:Arg, l:constantName)
endfunction
function! CandidateMagic(ArgLead, CmdLine, CursorPos)
let allWords = uniq(sort(split(join(getline("'<", "'>")), '\W\+')))
call filter(allWords, {idx, val -> -1 != stridx(val, a:ArgLead)})
return allWords
#! /bin/bash
BROWSER=Chrome
CANCELLED=0
COVERAGE_DATA=.coverage
COVERAGE_REPORT_DIR=htmlcov
POLL_INTERVAL=5
trap ctrl_c INT
#+OPTIONS: num:nil
* Bookmarks
** C-x r m - Create Bookmark
** C-x r l - List Bookmarks
Allows you to delete bookmarks. Does not use EVIL bindings.
* Spacemacs SPC Commands
** SPC ! - Shell Command
Runs a shell command in the current directory. The command output is captured
@timjstewart
timjstewart / ascii_comment.sh
Created April 23, 2018 20:27
Turns text into an ASCII text comment.
#! /bin/bash
# Makes an ASCII art rendition of the arguments and embeds it in a '#' comment.
# Requires figlet (e.g. homebrew install figlet)
# Only uses '#' comment style. Your JavaScript and C++ will not be happy.
figlet -w 80 -c $* | sed 's/^/#/'
@timjstewart
timjstewart / spacemacs-keys.org
Last active February 8, 2018 18:36
Spacemacs Keys I want to learn

Emacs

Buffers

KeyDescriptionStatus
SPC b C-dKill buffers using a regular expression.

Navigation

KeyDescriptionStatus
@timjstewart
timjstewart / new-sbt.sh
Created March 4, 2017 16:14
Create an Scala SBT project
#!/bin/bash
scala_version=2.12.1
function create_directories()
{
project_name=$1
mkdir -p ${project_name}/src/{main,test}/scala/com/timjstewart
}
import scala.util.Try
trait Show[T] {
def shows(t: T): Try[String]
}
trait ShowProtocol {
implicit val showAccount: Show[Account]
implicit val showCustomer: Show[Customer]
}