Skip to content

Instantly share code, notes, and snippets.

Vim(echoerr):Could not determine the Namespace of the file. This might have diff
erent reasons. Please check, that the ng server is running with the correct clas
spath and that the file does not contain syntax errors. The interactive features
will not be enabled, ie. the keybindings will not be mapped. Reason: Vim(let):E
484: Can't open file C:\Users\ADMINI~1\AppData\Local\Temp\VIo3633.tmp
Press ENTER or type command to continue
(defn files-in-dir
([dir]
(let [dirFile (File. dir)]
(.list dirFile)))
([dir suffix]
(let [dirFile (File. dir)
fileFilter (proxy [FilenameFilter] []
(accept [dir name] (.endsWith name suffix)))]
(.list dirFile fileFilter))))
(ns leiningen.repl
"Starts a REPL using the project's classpath."
(:use [leiningen.compile :only [eval-in-project find-lib-jars]])
(:require [clojure.main])
(:import [java.net URL URLClassLoader]
[java.io File FilenameFilter]))
(def *project*)
(def *classpath*)
; Also need to add (java.io StringReader) to :import at the top of the file
(defn- eval-opt
"Evals expressions in str, prints each non-nil result using prn"
[str]
(let [eof (Object.)
reader (LineNumberingPushbackReader. (StringReader. str))]
(loop [input (read reader false eof)]
(when-not (= input eof)
(let [value (eval input)]
(doto (javax.swing.JFrame.)
(.setSize 100 100)
(.addKeyListener (proxy [java.awt.event.KeyAdapter] [] (keyPressed [e] (println "hello"))))
(.setVisible true))
(defmulti url (fn [key &_] key))
(defmethod url :username [_ user] (str "/" user))
(defmethod url :home [_ _] "/")
(defmethod url :item [_ item] (str "/media/" item))
(defprotocol Base
(test-foo [o]))
(deftype Impl []
Base
(test-foo [_] "test"))
(defprotocol Base)
(defprotocol Base
GtkOffscreenWindow* offscreenWindow;
GtkPixmap* snapshotWidget(GtkWidget* widget) {
// Caching doesn't work, must create a new one every time (the widget parameter is gtk_widget_destroy'ed by the caller)
// if (!offscreenWindow)
offscreenWindow = gtk_offscreen_window_new();
gtk_container_add(offscreenWindow, widget);
gtk_widget_show(offscreenWindow);
force_draw(widget);
(use 'clojure.java.io)
(def string-url "http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html")
(defonce text (let [writer (java.io.StringWriter.)]
(copy (-> (java.net.URL. url) .openStream) writer) writer))
(defonce jdoc-pattern #"(?s)<A NAME=\"(\w*)\((.*?)\).*?</A>.*?<PRE>(.*?)</PRE>(.*?)<HR>")
(def html-entities
@remleduff
remleduff / gist:1876575
Created February 21, 2012 13:27
Simplified AST processing code from CinC
(use '[clojure.walk :only [walk]])
(def ^:dynamic ^:private *frame*)
(defn- new-frame [] (atom {}))
(defn- collect-frame [ast]
(case (:op ast)
:constant
{:constants [{:value (:form ast)}]}