Many AoC problems required some sort of path finding - shortest path, cheapest path according to the rules of the world.
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
(ns sort-compare.core) | |
(def team-data | |
[{:team-id 1 | |
:total-pts 7 | |
:matches [{:schedule-id 1 :opp-team-id 2 :opp-team-pts 6 :team-points 3} | |
{:schedule-id 2 :opp-team-id 3 :opp-team-pts 6 :team-points 4}]} | |
{:team-id 2 | |
:total-pts 7 | |
:matches [{:schedule-id 1 :opp-team-id 1 :opp-team-pts 3 :team-points 6} |
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
val test1a = [ | |
all_except_option("foo", []) = NONE, | |
all_except_option("foo", ["bar"]) = NONE, | |
all_except_option("foo", ["foo"]) = SOME([]), | |
all_except_option("foo", ["foo","x","y"]) = SOME(["x","y"]), | |
all_except_option("foo", ["x","foo","y"]) = SOME(["x","y"]), | |
all_except_option("foo", ["x","y","foo"]) = SOME(["x","y"])] | |
val test1b = [ |
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
(ns roll.core | |
(:require [instaparse.core :as instaparse] | |
[clojure.string :as str])) | |
(def roll-parser | |
(instaparse/parser " | |
roll = quantity? <'d'> die-type (operator operand)? | |
<quantity> = number | |
<die-type> = number | |
<operand> = number |
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
boolean saveImage(String fileName, String contentType, InputStream inputStream) { | |
Connection connection = null; | |
PreparedStatement statement = null; | |
ResultSet keySet = null; | |
try { | |
connection = dataSource.getConnection(); | |
statement = connection.prepareStatement("INSERT INTO images (filename, content_type, content) values (?, ?, ?)", | |
new String[] {"id"}); | |
statement.setString(1, fileName); |
Dear keyword match,
You vaguely look like someone capable of doing work.
I have a couple jobs that I'm not going to bother to describe because that would have meant I needed to take the time to look at your actual experience and see if any of them are actually a fit. But trust me, these are big time real jobs that actually exist and would be perfect for you based on the fact that you matched a keyword.
Instead of telling you more, I'm going to ask you to tell me what you are doing now. If my fishing trip is successful, then I'll take the time to look and see if you might be a fit for one of the jobs I'm recruiting for. If you are, I might get back to you.
Thanks for your time, Recruiter Dude.
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
package images; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletOutputStream; | |
import javax.servlet.annotation.WebServlet; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; |
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
(defun flatten (l) | |
(cond | |
((null l) nil) | |
((listp l) (append (flatten (car l)) | |
(flatten (cdr l)))) | |
(t (list l)))) | |
(flatten '()) | |
(flatten 1) | |
(flatten '(1 . 2)) |
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
(ns logic.sudoku | |
(:refer-clojure :exclude [==]) | |
(:use [clojure.core.logic]) | |
(:require [clojure.core.logic.fd :as fd])) | |
(defn init-board [vars puzzle] | |
(matche [vars puzzle] | |
([[] []] | |
succeed) |
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
// capturing the hide event instead of the hidden event lets us intercept the close and update our state | |
// | |
componentDidMount = () => { | |
$(this.node).on("hide.bs.modal", | |
(e) => { | |
if (this.props.open) { | |
// if we say the modal should be open but it want's to close | |
e.preventDefault(); // stop it from closing | |
this.props.closeMe(); // update our state to request our close, if we want that behavior | |
} |