Skip to content

Instantly share code, notes, and snippets.

View awolf's full-sized avatar

Adam J Wolf awolf

View GitHub Profile
@awolf
awolf / DOCKERFILE
Created January 13, 2019 20:54
Ruby and Docker - Dockerfile Sample
FROM ruby:2.2
RUN apt-get update && apt-get install -y build-essential
RUN mkdir -p /app
WORKDIR /app
RUN gem install bundler
@awolf
awolf / Clojure.clj
Created January 13, 2019 17:41
Brain Freeze from Clojure - Clojure
(defn indexed [coll] (map-indexed vector coll))
(defn index-filter [pred coll]
(when pred
(for [[idx elt] (indexed coll) :when (pred elt)] idx)))
(defn index-of-any [pred coll]
(first (index-filter pred coll)))
@awolf
awolf / sample.java
Last active January 13, 2019 17:39
Brain Freeze from Clojure - Java Version
public static int indexOfAny(String str, char[] searchChars) {
if (isEmpty(str) || ArrayUtils.isEmpty(searchChars)) {
return -1;
}
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);
for (int j = 0; j < searchChars.length; j++) {
if (searchChars[j] == ch) {
return i;