Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃
I may be slow to respond.

Sean Allred vermiculus

🙃
I may be slow to respond.
View GitHub Profile
@vermiculus
vermiculus / ReversePriorityQueue.java
Created Nov 5, 2012
Reverse Priority Queue (Example 4 for Alan)
View ReversePriorityQueue.java
import java.util.Comparator;
import java.util.PriorityQueue;
// Write a program that takes in 10 integers via command-line and prints them out in reverse natural order using a PriorityQueue. (this should use a Comparator)
public class ReversePriorityQueue
{
public class Reverse implements Comparator<Integer>
{
public int compare(Integer arg0, Integer arg1)
{
View melpautil.el
;; a packagelet for figuring out where melpa is. will move point to commit in magit-log buffers.
(defun melpautil-where-is-melpa (package &optional force-refresh)
(interactive (list (intern (let-alist (magithub-repo) .name))
current-prefix-arg))
(let ((commit (melpautil-commit-for-package package force-refresh)))
(unless commit
(error "Commit not found"))
(setq commit (magit-rev-parse "--short" commit))
(when (derived-mode-p 'magit-log-mode)
(goto-char 0)
View github-http-500.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src data:; script-src 'self'; style-src 'unsafe-inline'">
<meta content="origin" name="referrer">
<title>Server Error &middot; GitHub</title>
<style type="text/css" media="screen">
body {
background-color: #f1f1f1;
View oref-start.el
;;; Neat convenience function for working with Elisp's EIEIO objects
(defmacro oref* (object &rest slots)
"Like `oref', but each slot in SLOTS is applied in sequence.
For example,
\(oref* obj :inner :property)
is equivalent to
View magit-delete-trailing-whitespace-from-file.el
(defun *magit-delete-trailing-whitespace-from-file ()
"Removes whitespace from the current item."
(interactive)
(save-excursion
(magit-visit-item)
(delete-trailing-whitespace)
(save-buffer)
(kill-buffer))
(magit-refresh))
View paranoid-errors.el
;; Show a backtrace whenever an error is encountered
(defun user-error-to-backtrace (&rest r)
(with-current-buffer-window
(get-buffer-create "*issue*")
#'display-buffer-pop-up-window nil
(insert (kill-new (with-output-to-string (backtrace))))))
(mapc (lambda (e) (advice-remove e #'user-error-to-backtrace))
'(user-error error))
(mapc (lambda (e) (advice-add e :before #'user-error-to-backtrace))
View luminus+cider-nrepl.diff
Use CIDER's nREPL handler
2 files changed, 5 insertions(+), 2 deletions(-)
project.clj | 3 ++-
src/clj/myapp/core.clj | 4 +++-
modified project.clj
@@ -55,7 +55,8 @@
[ring/ring-mock "0.3.0"]
[ring/ring-devel "1.4.0"]
View makefile
pdf:
pdflatex -recorder word.tex
pdflatex word.tex
View solution.clj
(defn get-topic-children [topics topic-id]
(map first (filter #(= topic-id (:parent (second %))) topics)))
(defn get-routes [topics topic-id & [slug-so-far]]
(let [children (get-topic-children topics topic-id)
newslug (if (= topic-id :root) ""
(str slug-so-far "/" (:slug (get topics topic-id))))]
(if children
(into (if (= topic-id :root) {} {topic-id newslug})
(map #(get-routes topics % newslug) children))
@vermiculus
vermiculus / .gitignore
Last active Jan 3, 2016
A logical format for resumes and curriculum vitae
View .gitignore
/contact.tex