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
;; Initialize packages. | |
(require 'package) | |
(dolist (source '(("melpa" . "http://melpa.milkbox.net/packages/") | |
("marmalade" . "http://marmalade-repo.org/packages/"))) | |
(add-to-list 'package-archives source)) | |
(package-initialize) | |
(unless package-archive-contents |
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
;;; Let-bind variable | |
(emr-declare-action emr-extract-to-let emacs-lisp-mode "let-bind" | |
:predicate (not (or (emr--looking-at-definition?) | |
(emr--looking-at-decl?) | |
(emr--looking-at-let-binding-symbol?))) | |
:description "let") |
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
(eval-after-load "hideshow" | |
'(add-to-list 'hs-special-modes-alist | |
`(ruby-mode | |
,(rx (or "def" "class" "module" "{" "[")) ; Block start | |
,(rx (or "}" "]" "end")) ; Block end | |
,(rx (or "#" "=begin")) ; Comment start | |
ruby-forward-sexp nil))) |
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
#include <assert.h> | |
#include <stdlib.h> | |
#define Array_new(name, type, len) \ | |
typedef void(^name##_each)(type); \ | |
typedef void(^name##_each_i)(type, int); \ | |
\ | |
struct { \ | |
type *data; \ | |
size_t length; \ |
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
#include <stdio.h> | |
#include "array_obj.h" | |
int main() | |
{ | |
// Allocate an array of 5 ints. | |
Array_new(xs, int, 5); | |
// Initialize elements using their indices. | |
xs.each_i(^(int x, int i) { xs.set(i, i); }); | |
// Print elements. |
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
(defmacro cal (&rest expression) | |
"Evaluate algebraic EXPRESSION using calc." | |
(let* | |
((expr (with-temp-buffer | |
(lisp-mode) | |
(insert (->> expression | |
(-map 'pp-to-string) | |
(apply 'concat) | |
(s-replace (rx space) ""))) | |
;; Unpack unquote forms applied by the lisp reader. |
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
; Infix algebra in Lisp because yolo | |
(cal | |
sin(2) * ([1,2,3] + [4,5,6]) | |
) | |
; => [0.174497483513, 0.244296476918, 0.314095470323] |
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
(url-copy-file "http://ulrichdesign.ca/wp-content/uploads/2011/11/YOU-LACK-discipline.jpg" | |
"~/discipline.jpg") | |
(defun you-lack-discipline () | |
(interactive) | |
(insert-image (create-image "~/discipline.jpg"))) | |
(dolist (k '([up] [left] [down] [right])) | |
(global-set-key k 'you-lack-discipline)) |
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
// Compiler from Go types to an S-Expression representation. | |
// | |
// The output a drop-in replacement for the Elisp JSON parser output, and can be | |
// consumed directly with `read`. | |
package main | |
import ( | |
"strconv" | |
"strings" |