Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🐱

Philipp Fehre sideshowcoder

💭
🐱
View GitHub Profile
@sideshowcoder
sideshowcoder / git-link-sourcegraph.el
Last active Mar 24, 2021
Configure git-link for sourcegraph
View git-link-sourcegraph.el
@sideshowcoder
sideshowcoder / bloop.el
Last active Oct 10, 2021
Bloop integration for Emacs
View bloop.el
;;; bloop --- bloop minor mode
;; Author: Philipp Fehre <philipp@fehre.co.uk>
;; Keywords: scala, bloop, tools, convenience
;;; Commentary:
;; Helpers to integrate better with bloop, inspired by emacs-bloop
;; https://github.com/tues/emacs-bloop/blob/master/bloop.el
;; C-c M-j jack-in a bloop project running a new Ammonite REPL buffer
View coders-little-helper.el
;;; coders-little-helper -- all kind of helper functions
;;
;;; Commentary:
;; Helper functions for all kind of daily Emacs stuff.
;;
;; Run tests on the command line:
;;
;; emacs -batch -l coders-little-helper.el
;;
;; From inside Emacs
View Makefile
# Use Mermaid (https://github.com/knsv/mermaid) and Markdown to create word docs
# with diagrams.
# Requires Pandoc and mermaid pandoc filter to process all md files in the
# current folder to html and the html to docx for word
# see https://github.com/raghur/mermaid-filter
SRC = $(wildcard *.md)
DIA = $(SRC:.md=.html)
DOCS = $(DIA:.html=.docx)
View keybase.md

Keybase proof

I hereby claim:

  • I am sideshowcoder on github.
  • I am sideshowcoder (https://keybase.io/sideshowcoder) on keybase.
  • I have a public key ASAEE-dQHXaxnF5kXmIlTg3XB_YoqdRpORJs-L2ImDIItgo

To claim this, I am signing this object:

View .bashrc.sh
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \w\$(parse_git_branch) \\$ "
View my_funcs.el
;; automatically open a file as sudo unless we have permission to write it
;; already, after all this is my machine and I can do what I want!
(defadvice ido-find-file (after find-file-sudo activate)
"Find file as root if necessary."
(unless (and buffer-file-name
(file-writable-p buffer-file-name))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
View go-guru-scope.el
(defun coder/go-guru-set-current-package-as-main ()
"GoGuru requires the scope to be set to a go package which
contains a main, this function will make the current package the
active go guru scope, assuming it contains a main"
(interactive)
(let* ((filename (buffer-file-name))
(gopath-src-path (concat (file-name-as-directory (go-guess-gopath)) "src"))
(relative-package-path (directory-file-name (file-name-directory (file-relative-name filename gopath-src-path)))))
(setq go-guru-scope relative-package-path)))
@sideshowcoder
sideshowcoder / rspec_file.el
Created Feb 9, 2017
Run rspec on file in emacs (depends on rake.el and projectile)
View rspec_file.el
(defun coder/rspec-file ()
"Run rspec on the current file and set as the compile target,
if we have zeus available than run it via zeus otherwise run it
via bundle exec rspec"
(interactive)
(projectile-with-default-dir (projectile-project-root)
(let ((command-prefix (rake--choose-command-prefix (projectile-project-root) (list :zeus "zeus test "
:bundler "bundle exec rspec "))))
(compile (concat command-prefix (coder/project-relative-current-file-path))))))
@sideshowcoder
sideshowcoder / calculator.fsx
Created Sep 5, 2016
F# Reverse Polish notation (RPN) Calculator
View calculator.fsx
open System
type Token =
| Number of int
| UnaryOperator of (int -> int -> int)
let tryCharToToken a =
match (Int32.TryParse a) with
| (true, num) -> Some (Number num)
| (false, _) ->