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
<input type="text" name="email" value="Enter your email address" onclick="this.value=''" /> |
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
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) |
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
;; 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")) |
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
;; 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]) |
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
;; surrounding in * suggests the var is meant to be rebound using binding or used as a | |
;; global variable or constant | |
(def *earmuffs*) |
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
# 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' |
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
;; 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)) |
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
require 'spec' | |
class Something | |
def initialize | |
do_something | |
end | |
def do_something | |
raise NotImplementedError.new("Not Yet Implemented") | |
end |
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
(font-lock-add-keywords | |
'ruby-mode | |
'(("\\([-,\\+\\*/%&|\\^~=>]\\)" . font-lock-keyword-face))) |
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
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 |