Skip to content

Instantly share code, notes, and snippets.

View neilmock's full-sized avatar

Neil Mock neilmock

View GitHub Profile
<input type="text" name="email" value="Enter your email address" onclick="this.value=''" />
Exception in thread "main" java.lang.ClassCastException: java.io.StringWriter (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:4658)
at clojure.core$eval__5254.invoke(core.clj:2031)
at clojure.main$eval_opt__7429.invoke(main.clj:225)
at clojure.main$initialize__7436.invoke(main.clj:244)
at clojure.main$null_opt__7464.invoke(main.clj:269)
at clojure.main$main__7484.doInvoke(main.clj:338)
at clojure.lang.RestFn.invoke(RestFn.java:426)
at clojure.lang.Var.invoke(Var.java:363)
at clojure.lang.AFn.applyToHelper(AFn.java:175)
;; must be AOT compiled as far as I can tell
(ns com.example.ExampleJob
(:use [clojure.contrib.duck-streams :only [spit]])
(:gen-class
:implements [org.quartz.Job]))
(defn -execute
[this context]
(spit "qrtz.txt" "HI"))
;; i have a vector [1 2 3]
;; i want to produce a hash map as follows:
;; {1 <1 + 1> 2 <2 + 1> 3 <3 + 1>}
;; {1 2, 2 3, 3 4}
(reduce (fn [m x] (assoc m x (+ x 1))) {} [1 2 3])
;; surrounding in * suggests the var is meant to be rebound using binding or used as a
;; global variable or constant
(def *earmuffs*)
# SSL redirect middleware
#
# Use as follows in url configs:
#
# (r'^registration/', include('myapp.registration.urls'), {'SSL':True}),
from django.conf import settings
from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect, get_host
SSL = 'SSL'
;; puts all jars in ~/lib/jars on the classpath for slime interaction
;; should come after (clojure-slime-config) has been evaluated
(dolist (jarfile (directory-files "~/lib/jars" t "\\.jar$"))
(add-to-list 'swank-clojure-classpath jarfile))
require 'spec'
class Something
def initialize
do_something
end
def do_something
raise NotImplementedError.new("Not Yet Implemented")
end
(font-lock-add-keywords
'ruby-mode
'(("\\([-,\\+\\*/%&|\\^~=>]\\)" . font-lock-keyword-face)))
def linebreaksul(value):
"""
Converts a series of newlines into list items enclosed in an unordered list.
"""
unordered_list = "<ul>"
# split value into individual elements separated by newline
list_items = value.split('\n')
for li in list_items:
unordered_list += "<li>%s</li>" % li