Skip to content

Instantly share code, notes, and snippets.

View mathieurousseau's full-sized avatar

Mathieu Rousseau mathieurousseau

View GitHub Profile
@mathieurousseau
mathieurousseau / largest_query.exs
Created November 27, 2024 23:05
largest query
{[:all, {:prefix, "public"}, {:union, [:all, {:prefix, "public"}, {:where, [and: {:and, [], [{:fragment, [], [raw: "", expr: {{:., [], [{:&, [], [0]}, :args]}, [], []}, raw: " @> ", expr: {:^, [], [0]}, raw: ""]}, {:and, [], [{:==, [], [{{:., [], [{:&, [], [0]}, :worker]}, [], []}, {:^, [], [1]}]}, {:in, [], [{{:., [], [{:&, [], [0]}, :state]}, [], []}, {:^, [], [2]}]}]}]}]}, {:from, {"oban_jobs", Oban.Job, 16371104, nil}, []}, {:select, [{:type, [], [{:^, [], [0]}, :string]}, {{:., [], [{:&, [], [0]}, :id]}, [], []}, {{:., [], [{:&, [], [0]}, :state]}, [], []}]}]}, {:union, [:all, {:prefix, "public"}, {:where, [and: {:and, [], [{:fragment, [], [raw: "", expr: {{:., [], [{:&, [], [0]}, :args]}, [], []}, raw: " @> ", expr: {:^, [], [0]}, raw: ""]}, {:and, [], [{:==, [], [{{:., [], [{:&, [], [0]}, :worker]}, [], []}, {:^, [], [1]}]}, {:in, [], [{{:., [], [{:&, [], [0]}, :state]}, [], []}, {:^, [], [2]}]}]}]}]}, {:from, {"oban_jobs", Oban.Job, 16371104, nil}, []}, {:select, [{:type, [], [{:^, [], [0]}, :string]}
[{[:update_all, {:prefix, "public"}, {:select, {:&, [], [0]}}, {:where, [and: {:and, [], [{:and, [], [{:==, [], [{{:., [], [{:&, [], [0]}, :id]}, [], []}, {{:., [], [{:&, [], [1]}, :id]}, [], []}]}, {:==, [], [{{:., [], [{:&, [], [0]}, :state]}, [], []}, %Ecto.Query.Tagged{tag: nil, type: {0, :state}, value: "available"}]}]}, {:<, [], [{{:., [], [{:&, [], [0]}, :attempt]}, [], []}, {{:., [], [{:&, [], [0]}, :max_attempts]}, [], []}]}]}]}, {:join, [{:inner, {{:fragment, [], [raw: "\"subset\""]}, nil}, true, []}]}, {:update, [[set: [state: {:^, [], [0]}, attempted_at: {:^, [], [1]}, attempted_by: {:^, [], [2]}], inc: [attempt: {:^, [], [3]}]]]}, {:from, {"oban_jobs", Oban.Job, 16371104, nil}, []}, {:non_recursive_cte, "subset", nil, :all, [:all, {:prefix, "public"}, {:take, %{0 => {:any, [:id]}}}, {:limit, {false, {:^, [], [0]}}}, {:order_by, [[asc: {{:., [], [{:&, [], [0]}, :priority]}, [], []}, asc: {{:., [], [{:&, [], [0]}, :scheduled_at]}, [], []}, asc: {{:., [], [{:&, [], [0]}, :id]}, [], []}]]}, {:where,
https://play.google.com/apps/internaltest/4701648549761098209
public class TicTacToe {
public static boolean valid(String[] plays) {
int xCount = 0;
int oCount = 0;
for (String p : plays) {
if (!"x".equals(p) && !"o".equals(p) && !"".equals(p)) {
return false;
}
if ("x".equals(p))