Skip to content

Instantly share code, notes, and snippets.

@justinbarclay
justinbarclay / initialize-function.el
Last active September 26, 2022 22:24
lsp-start-plain file with corfu support
(defun lsp-start-plain ()
"Start `lsp-mode' using mininal configuration using the latest `melpa' version
of the packages.
In case the major-mode that you are using for "
(interactive)
(let ((start-plain (make-temp-file "plain" nil ".el")))
(url-copy-file "https://gist.githubusercontent.com/justinbarclay/1d143735e55dd7c481c08a7a27c15ae3/raw/a4270553358ccd9bf82e43e1de2bf01e383b25a3/lsp-start-plain-corfu.el"
start-plain t)
(async-shell-command
### Keybase proof
I hereby claim:
* I am justinbarclay on github.
* I am justinbarclay (https://keybase.io/justinbarclay) on keybase.
* I have a public key ASCNUY7u_RMtQ96cS3G8Ac8CunptwBHhluUu0fssiBx1wQo
To claim this, I am signing this object:
@justinbarclay
justinbarclay / string_ops.el
Last active November 1, 2019 00:20
string ops
(setq source-string "f/DUNLOP-1234_Do_A_Thing")
(let* ((replaced-string (replace-regexp-in-string "DUNLOP" "D" source-string)))
(max (string-match "_" replaced-string))
(almost-done (substring replaced-string 0 max))
(concat almost-done ":\n\n"))
(with-temp-buffer
(insert source-string)
(beginning-of-buffer)

Hello

World

Thing

Here is a test

(ert-deftest parinfer-indent-0 ()
(let ((before
"|(defn foo
[arg
ret")
(after
"(defn foo
[arg]
ret)")
(should (equal (run-parinfer-in-another-buffer before)
@justinbarclay
justinbarclay / intro-to-emacs.org
Last active April 4, 2019 20:16
An introduction to various resources to help learn Emacs

Getting Started

Preconfigured Emacs

  • Prelude Prelude is an Emacs distribution that aims to enhance the default Emacs experience. Prelude alters a lot of the default settings, bundles a plethora of additional packages and adds its own core library to the mix. The final product offers an easy to use Emacs configuration for Emacs newcomers and lots of additional power for Emacs power users.
  • Doom It is a story as old as time. A stubborn, shell-dwelling, and melodramatic vimmer – envious of the features of modern text editors – spirals into despair before finally succumbing to the dark side. This is his config.

    Doom strives to be fast, fabulous and hacker friendly. It is tailored for neckbeards with blue belts or better in command-line-fu, Elisp and git.

@justinbarclay
justinbarclay / hyper_server_example.rs
Last active May 14, 2018 22:15
A sample hyper server for reaching out to public JSON api and filtering for specific values
extern crate futures;
extern crate hyper;
extern crate pretty_env_logger;
extern crate tokio_core;
extern crate hyper_tls;
extern crate serde_json;
use futures::Stream;
use futures::Future;
(ns tools.debug)
; Case 1: Show the state of a bunch of variables.
;
; > (inspect a b c)
;
; a => 1
; b => :foo-bar
; c => ["hi" "world"]
;
// In response to: http://lisperator.net/blog/a-little-javascript-problem/
function range(start, end){
let next = start;
return function(){
if(start < end && next <= end ){
return next++;
} else {
return null;
}
};
;; A minimal, but nice, config for getting Slack working in Emacs with VIM bindings and alerts
(setq gc-cons-threshold 1000000000)
(run-with-idle-timer
5 nil
(lambda ()
(setq gc-cons-threshold 10000000)
(message "gc-cons-threshold restored to %S"
gc-cons-threshold)))
(require 'package)