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
;; -*- mode: Lisp; lexical-binding: t; -*- | |
(defun global-set-umlaut-keys () | |
(let ((gen-insert-key | |
(lambda (key) | |
(lambda () | |
(interactive) | |
(ucs-insert key))))) | |
(global-set-key (kbd "\C-co") (funcall gen-insert-key #xf6)) | |
(global-set-key (kbd "\C-cu") (funcall gen-insert-key #xfc)) |
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 nif [expr pos zero neg] | |
`(let [~res# ~expr] | |
(cond (> ~res# 0) ~pos | |
(= ~res# 0) ~zero | |
:else ~neg))) |
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
(macroexpand | |
'(nif (random 100) 'positive 'zero 'negative)) | |
;; Expands to: | |
(LET ((#:RESULT3117 (RANDOM 100))) (COND ((PLUSP #:RESULT3117) 'LET-OVER-LAMBDA.G!.EXAMPLES::POSITIVE) ((ZEROP #:RESULT3117) 'LET-OVER-LAMBDA.G!.EXAMPLES::ZERO) (T 'LET-OVER-LAMBDA.G!.EXAMPLES::NEGATIVE))) | |
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/g! nif (expr pos zero neg) | |
`(let ((,g!result ,expr)) | |
(cond ((plusp ,g!result) ,pos) | |
((zerop ,g!result) ,zero) | |
(t ,neg)))) |
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
public static void load(String relativePath) | |
{ | |
bool loadAsResource = EmbeddedAssembly(relativePath); | |
load(relativePath, true, loadAsResource); | |
} | |
private static bool EmbeddedAssembly(String relativePath) | |
{ | |
return (ResourceData(ResourceName(relativePath)) != null); | |
} |
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
static Assembly ResolveAssembly(object sender, ResolveEventArgs args) | |
{ | |
var name = args.Name.Split(',').FirstOrDefault(); | |
if (String.IsNullOrEmpty(name) || name.EndsWith(".resources")) return null; | |
name = name.Replace('.', '_'); | |
var data = (byte[])Properties.Resources.ResourceManager.GetObject(name); | |
return (data == null) ? null : Assembly.Load(data); | |
} |
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
;; -*- mode: Lisp; lexical-binding: t; -*- | |
;; ---------------------------------------------------------------------- | |
;; HELPER FUNCTIONS | |
;; ---------------------------------------------------------------------- | |
(defvar electrify-return-match | |
"[\]}\)\"]" | |
"If this regexp matches the text after the cursor, do an \"electric\" | |
return.") |
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
;;;; pretty-literals.lisp - pretty hash table & vector literal syntax | |
;;;; inspired by and uses code from http://frank.kank.net/essays/hash.html | |
(in-package #:pretty-literals) | |
;; vector literal syntax using brackets | |
(set-macro-character #\[ | |
(lambda (str char) | |
(declare (ignore char)) | |
(let ((*readtable* (copy-readtable *readtable* 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
;; Copyright (c) Ralph Moritz. All rights reserved. | |
;; The use and distribution terms for this software are covered by the Eclipse | |
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which | |
;; can be found in the file epl-v10.html at the root of this distribution. By | |
;; using this software in any fashion, you are agreeing to be bound by the | |
;; terms of this license. You must not remove this notice, or any other, from | |
;; this software. | |
(ns | |
^{:author "Ralph Moritz" |
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
(defproject jwt-examples "0.1.0" | |
:description "Clojure versions of JWT example programs" | |
:dependencies [[org.clojure/clojure "1.2.1"] | |
[jetty-wrapper "0.1.1"]]) |