This file contains hidden or 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 open-file (path) | |
"Open the file PATH and return a string of its contents." | |
(with-temp-buffer | |
(insert-file-contents-literally path) | |
(buffer-substring (point-min) (point-max)))) |
This file contains hidden or 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
(require 'dash) | |
(defun replace-nested-list (from to list) | |
"Replace all occurrences of atom FROM with TO in an arbitrarily nested LIST." | |
(--map | |
(cond | |
((consp it) (in-ns--replace-nested-list from to it)) | |
((eq it from) to) | |
('t it)) | |
list)) |
This file contains hidden or 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 -e | |
echo 'Creating ~/.pip-cache...' | |
mkdir -p ~/.pip-cache | |
echo 'Writing ~/.pip/pip.conf...' | |
mkdir -p ~/.pip |
This file contains hidden or 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
#include <stdio.h> | |
int banana(int x) { | |
return; | |
} | |
void main() { | |
int c; | |
printf("c: %d, banana: %d\n", c, banana(1)); |
This file contains hidden or 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
----- Linting by /usr/bin/emacs ----- | |
Loading vc-git... | |
Evaluating (progn (require (quote cl)) (require (quote easy-mmode)))... | |
Evaluating (require (quote flymake) nil t)... | |
Initializing elint... | |
uncompressing tooltip.el.gz... | |
uncompressing tooltip.el.gz...done | |
uncompressing syntax.el.gz... | |
uncompressing syntax.el.gz...done |
This file contains hidden or 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* virtualenv-search--dwim-at-point () | |
"If there's an active selection, return that. | |
Otherwise, get the symbol at point and return a search term for its definition." | |
(when (use-region-p) | |
(return (buffer-substring-no-properties (region-beginning) (region-end)))) | |
(-when-let* ((symbol (symbol-at-point)) | |
(symbol-name (symbol-name symbol))) | |
(return (format "%s %s" (if (s-lowercase? symbol-name) "def" "class") symbol-name)))) ;; return should be return-from virtualenv-search--dwim-at-point | |
(defun virtualenv-search () |
This file contains hidden or 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
from django.core.cache import cache | |
from functools import wraps | |
from inspect import ismethod | |
import copy | |
def make_hash(obj): | |
"""Make a hash from an arbitrary nested dictionary, list, tuple or | |
set. |
This file contains hidden or 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
;;; show-your-colours --- an HTTP server showing the current buffer fontified | |
;; Author: Wilfred Hughes <[email protected]> | |
;; Version: 0.1 | |
;; Package-Requires: ((s "1.3.0")) | |
;;; Commentary: | |
;; Allow others to see what you're editing in Emacs. For live | |
;; screencasts, or general Emacs advocacy. If you have multiple |
This file contains hidden or 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
;; tco.el --- tail-call optimisation -*- lexical-binding: t -*- | |
(require 'dash) | |
(eval-when-compile (require 'cl)) | |
(setq lexical-binding 't) | |
(defun tco-add-trampoline (fun-name new-name form) | |
"Given quoted soure FORM, replace calls to FUN-NAME (a symbol) | |
with a lambda expression that returns the result of the FUN-NAME call." | |
(--map |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<style> | |
#dock { | |
width: 70px; | |
background-color: green; | |
height: 100%; |