This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun toggle-maximize-buffer () "Maximize buffer" | |
(interactive) | |
(if (= 1 (length (window-list))) | |
(jump-to-register '_) | |
(progn | |
(set-register '_ (list (current-window-configuration))) | |
(delete-other-windows)))) | |
;; Bind it to a key. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is implemented following the instructions in "The Design and Analysis of | |
Computer Algorithms, AHO Hopcroft Ullman, 1974". | |
The implementation uses a DFS to find the strongly connected components (SCCs) | |
of a graph. During the DFS the vertices are placed on a stack in the order | |
they are visited. Whenever a root is found, all vertices of the corresponding | |
SSC are on the top of the stack and are popped. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This script will install the following Textmate bundles | |
# | |
# Languages | |
# - c https://github.com/textmate/c.tmbundle | |
# - coffeescript https://github.com/jashkenas/coffee-script-tmbundle | |
# - context free https://github.com/textmate/context-free.tmbundle | |
# - erlang https://github.com/textmate/erlang.tmbundle | |
# - haskell https://github.com/textmate/haskell.tmbundle.git | |
# - html https://github.com/textmate/html.tmbundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Peano { | |
sealed trait Nat | |
trait Zero extends Nat | |
object ZeroV extends Zero | |
case class Succ[A <: Nat](x: A) extends Nat | |
trait Sum[A <: Nat, B <: Nat] { | |
type Out <: Nat | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
function is-git-repository { | |
[[ -d "$1/.git" ]] || (cd "$1" && git rev-parse --git-dir > /dev/null 2>&1) | |
} | |
function echo-is-dirty { | |
cd "$1" | |
if [[ ! -z $(git status -s) ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I tried to translate the GADT examples I have in my blog post[1] about GADTs | |
// from OCaml to Scala. | |
// | |
// A direct translation resulted in the code below, but I had to add two asInstanceOf | |
// so I don't consider this a successful translations. | |
// | |
// Any idea how to get rid of the asInstanceOf calls? Is it even possible? | |
// | |
// [1]: http://mads-hartmann.com/ocaml/2015/01/05/gadt-ocaml.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# usage: prototype-deploy <machine-name> <image-name> <container-name> | |
# | |
set -euo pipefail | |
# | |
# Functions | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun mhj/show-project-explorer () | |
"Project dired buffer on the side of the frame. | |
Shows the projectile root folder using dired on the left side of | |
the frame and makes it a dedicated window for that buffer." | |
(let ((buffer (dired-noselect (projectile-project-root)))) | |
(progn | |
(display-buffer-in-side-window buffer '((side . left) (window-width . 0.2))) | |
(set-window-dedicated-p (get-buffer-window buffer) t) | |
(select-window (get-buffer-window buffer))))) |
NewerOlder