Skip to content

Instantly share code, notes, and snippets.

@fletch
fletch / foo.clj
Last active May 17, 2016
weasel incantation
View foo.clj
;;; old
(require 'weasel.repl.websocket)
(cemerick.piggieback/cljs-repl (weasel.repl.websocket/repl-env))
;;; 20160517
(use 'figwheel-sidecar.repl-api)
(start-figwheel!)
(cljs-repl)
@fletch
fletch / yas-company-helm.el
Last active Apr 24, 2019
Yasnippet + company + helm
View yas-company-helm.el
;; http://emacs.stackexchange.com/questions/10431/get-company-to-show-suggestions-for-yasnippet-names
;; Add yasnippet support for all company backends
;; https://github.com/syl20bnr/spacemacs/pull/179
(defvar company-mode/enable-yas t
"Enable yasnippet for all backends.")
(defun company-mode/backend-with-yas (backend)
(if (or (not company-mode/enable-yas) (and (listp backend) (member 'company-yasnippet backend)))
backend
(append (if (consp backend) backend (list backend))
@fletch
fletch / .ctags
Last active Sep 14, 2015
Readonly::Foo and use constant support for ctags
View .ctags
--regex-perl=/Readonly::[a-zA-Z0-9_]+ my [\$@%]([a-zA-Z0-9_]+)/\1/C,Readonly:: constant/
--regex-perl=/use constant ([A-Z][a-zA-Z0-9_]+)/\1/c,use constant/
--regex-perl=/has[[:space:]]+([[:alnum:]_]+)[[:space:]]*=>/\1/M,moose attribute/e
@fletch
fletch / sample-helm-file.el
Last active Aug 29, 2015
helm file source sample
View sample-helm-file.el
(helm :sources
(helm-build-in-file-source
"dirtest" (expand-file-name "~/.dirs")
:candidate-transformer
(lambda (strs)
(mapcar
(lambda (str)
(destructuring-bind (name dir)
(s-split "=" str)
(cons name dir)))
@fletch
fletch / sauron_msg
Last active Aug 29, 2015
shell function sending messages to sauron using dbus
View sauron_msg
# -*- sh -*-
sauron () {
local opt_f=zsh opt_S=3 action=AddMsgEvent
local myname=${(%):-%N}
local -a extra_args
while getopts "S:f:u:" opt; do
if [[ $opt = "?" ]]; then
print -r -- "$myname: unrecognized option: -$OPTARG" >&2
return 1
View 2num.pl
#!/opt/local/bin/perl
##
## Slightly more idiomatic and optimized Perl of 2num.pl from
## http://github.com/brendano/awkspeed/tree/master
##
use strict;
use warnings;
open( my $vocab_fh, '>', "vocab" ) or die "vocab: $!\n";