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
FROM ruby:2.2 | |
RUN apt-get update && apt-get install -y build-essential | |
RUN mkdir -p /app | |
WORKDIR /app | |
RUN gem install bundler |
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
(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))) |
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
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; |