Skip to content

Instantly share code, notes, and snippets.

@semperos
semperos / clj-new.sh
Created February 12, 2018 22:47
Project scaffolding relying on clj/clojure at system level
#!/bin/bash
#
# Usage: clj-new <project-name>
#
# The project-name will be sanitized to handle JVM directory requirements.
# Relies on clj/clojure being installed at the system level.
#
# TODO Support app vs. lib scripts and code
# TODO Support "all defaults" rather than requiring user interactivity
# TODO For dot-nested project name, make final root directory only the final portion of the project name (i.e., `foo` instead of `com.example.foo`)
@semperos
semperos / deps.edn
Last active September 5, 2019 19:32
Clojure deps.edn Workflow
{:aliases {:dev {:extra-deps
{org.clojure/tools.nrepl {:mvn/version "0.2.13"}
cider/cider-nrepl {:mvn/version "0.17.0-SNAPSHOT"}}}
:std {:extra-paths ["resources"]}
:test {:extra-paths ["test"]}}
:mvn/repos {"private-repo" {:url "https://example.com/repository/maven-releases/"}}}
@semperos
semperos / .spacemacs
Last active November 27, 2017 21:45
Spacemacs dotspacemacs/user-config
;; In dotspacemacs/layers:
dotspacemacs-configuration-layers
'(
better-defaults
clojure
emacs-lisp
git
org
ivy
)
@semperos
semperos / Long.java
Created August 2, 2017 16:07
Java's Parse Long
public static long parseLong(String s, int radix)
throws NumberFormatException
{
if (s == null) {
throw new NumberFormatException("null");
}
if (radix < Character.MIN_RADIX) {
throw new NumberFormatException("radix " + radix +
" less than Character.MIN_RADIX");
@semperos
semperos / pull-request-template.md
Last active August 8, 2016 17:12 — forked from Lordnibbler/pull-request-template.md
Sample Pull Request Template

Stories

Status

Check these boxes as they're completed.

  • Dev Planning/Spike
  • 30% Review
@semperos
semperos / carcdr.clj
Created July 20, 2016 02:05
Generate car, cdr, cadr, cdar, etc. in Clojure
(ns semperos.hs
(:require [clojure.string :as str]))
(defn strip-first-last
"Strip first and last letter from string."
[s]
(subs (subs s 1) 0 (- (count s) 2)))
(def step-fns {\a first \d next})
@semperos
semperos / ifs.clj
Last active June 21, 2016 15:35
Proposed if-seq and if-some*
(defmacro if-seq
"bindings => binding-form test
If test is true, evaluates then with binding-form bound to the value of
test, if not, yields else"
([bindings then]
`(if-seq ~bindings ~then nil))
([bindings then else & oldform]
(#'clojure.core/assert-args
(vector? bindings) "a vector for its binding"
/**
* Parses the string argument as a signed integer in the radix
* specified by the second argument. The characters in the string
* must all be digits of the specified radix (as determined by
* whether {@link java.lang.Character#digit(char, int)} returns a
* nonnegative value), except that the first character may be an
* ASCII minus sign {@code '-'} ({@code '\u005Cu002D'}) to
* indicate a negative value or an ASCII plus sign {@code '+'}
* ({@code '\u005Cu002B'}) to indicate a positive value. The
* resulting integer value is returned.
@semperos
semperos / ants.clj
Last active June 14, 2016 17:58
Rich Hickey's Original Ant Simulation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
#!/bin/bash
curl -o endeca-resp.bytes 'http://ag640-endeca.vip.ci.atl.primedia.com:15400/graph?node=0&select=topfeatures|listingbedlow|propertystatelong|propertystate|listingbedavailunitcount|hdtour|stardisplay|listingid|spotlight|semtollfree|mgtcologo|propertycity|numratings|listingbedhigh|avgoverallrating|longitude|listingseopath|neighborhoods|lastupdate|latitude|hdvideo|mgtcoid|propertyzip|webtollfree|_source|listingbedpricerange|mgtcodescription|hoodurls|hashdphotos|mainimage|listingpricelow|hashdfp|cityseopath|hidecurrentrentspecialsreq|listingpricehigh|totalunits|coupontext|propertyname|lifestyles|mgtconame|addressline1|photos|mgtcoseopath|listingbathhigh|listingbathlow|halfbaths|numphotos|bold|altwebtollfree|diamondmax|fladisplay&groupby=listingid&offset=0&nbins=20&allbins=1&attrs=showapartment|1|mode%2bmatchall&pred=geocode%7cGCLT+32.783300%2c-96.800000+32.18694175772889&filter=AND%28AND%28lifestyle%3aCollege%29%2cAND%28lifestyle%3aLuxury+Community%29%29&irversion=640' --verbose