Skip to content

Instantly share code, notes, and snippets.

(defn select-keys* [m paths]
(apply merge-in
(map #(cond
(nil? %) nil
(not (sequential? %)) {% (get m %)}
(= 1 (count %)) {(first %) (get m (first %))}
:else {(first %) (select-keys* (get m (first %)) [(rest %)])})
paths)))
(comment

Keybase proof

I hereby claim:

  • I am markhepburn on github.
  • I am markhepburn (https://keybase.io/markhepburn) on keybase.
  • I have a public key ASBGBclrmAkauCNfW52UjGoxuOQGdE18s5o8_voPpGHlTwo

To claim this, I am signing this object:

@markhepburn
markhepburn / figwheel.clj
Created September 27, 2017 23:38
Patch cljs compiler for emacs-on-windows
;; The cljs compiler currently uses string-matching for path comparison; on windows (case-insensitive)
;; for some reason I have both C:\... and c:\... present, which fails. This is my monkey-patch.
;; See https://dev.clojure.org/jira/browse/CLJS-2221
(in-ns 'cljs.util)
(require '[clojure.java.io :as io]
'[clojure.string :as string])
(import '[java.net URLDecoder])
(defn ^String relative-name
;;; toggle-case.el --- toggles case at point like ~ in vi
;; @(#) $Id: toggle-case.el,v 1.5 2008/11/20 23:40:53 joe Exp $
;; This file is not part of Emacs
;; Copyright (C) 2001 by Joseph L. Casadonte Jr.
;; Author: Joe Casadonte (emacs@northbound-train.com)
;; Maintainer: Joe Casadonte (emacs@northbound-train.com)
;; Package-Version: 1.5
;; Created: January 03, 2001
@markhepburn
markhepburn / Program.cs
Created January 5, 2016 11:57 — forked from cbilson/Program.cs
Migrating C# OWIN app to ClojureCLR
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using clojure.clr.api;
using clojure.lang;
using Microsoft.Ajax.Utilities;
using Microsoft.Owin.Hosting;
using Owin;

Keybase proof

I hereby claim:

  • I am markhepburn on github.
  • I am markhepburn (https://keybase.io/markhepburn) on keybase.
  • I have a public key whose fingerprint is 65D5 8DDA 447D 1466 CB47 911B EF73 DD14 3AB3 EAC0

To claim this, I am signing this object:

;;; In all its on-the-day gory glory. I will admit to being
;;; /slightly/ on the seedy side... Most of these solutions,
;;; particularly problems 3 and 4, are brute-forced and I'm pretty
;;; sure can be more solved much more efficiently. I'll have a stab
;;; later, but this is all I got up to (I was starting to look at
;;; seesaw for a game-of-life GUI, but as you can see didn't get too
;;; far)
;;;
;;; Thanks everyone! It was great to see so many people passionate
;;; about Clojure, and I'm really greatful to Logaan and all the
(org-mobile-pull) ;; run org-mobile-pull at startup
(defun install-monitor (file secs)
(run-with-timer
0 secs
(lambda (f p)
(unless (< p (second (time-since (elt (file-attributes f) 5))))
(org-mobile-pull)))
file secs))
(defvar org-mobile-push-timer nil
"Timer that `org-mobile-push-timer' used to reschedule itself, or nil.")
(defun org-mobile-push-with-delay (secs)
(when org-mobile-push-timer
(cancel-timer org-mobile-push-timer))
(setq org-mobile-push-timer
(run-with-idle-timer
(* 1 secs) nil 'org-mobile-push)))