Skip to content

Instantly share code, notes, and snippets.

View JpOnline's full-sized avatar

João Paulo de Souza Soares JpOnline

View GitHub Profile
@JpOnline
JpOnline / aoc-2023-14.clj
Last active December 14, 2023 08:31
Advent of Code 2023 Day 14
;; ---- Day 14 ----
(def input
"O....#....
O.OO#....#
.....##...
OO.#O....O
.O.....O#.
O.#..O.#.#
..O..#O..O
@JpOnline
JpOnline / aoc-2023-10.clj
Last active December 10, 2023 22:22
Advent of Code 2023 Day 10
;; ---- Part 1 ----
(def input-1
{:board
".....
.F-7.
.|.|.
.L-J.
....."
:current [1 1]
(ns ms)
(defn board->pos-map [board]
(into {} (flatten (map-indexed (fn [i line] (map-indexed (fn [j c] {[i j] c}) line)) board))))
(defn stat-pos-map->board [pos-map]
(mapv #(clojure.string/join \space (map second %))
(partition-by ffirst (sort pos-map))))
(defn get-adjacents [pos-map [i j]]
(ns nothing.advent)
;; ---------- Day 2 ----------
(defn insert-into [original position element]
(let [[before after] (split-at position original)]
(vec (concat before [element] (rest after)))))
(defn program-alarm
([data input] (program-alarm data 0 input))
// General e2e test that click random things in a page checking the
// events and state of a Re-Frame app.
//
// To Run
// npm i puppeteer
// node puppeteer-clicking-randomly.js
const puppeteer = require('puppeteer');
var fs = require('fs');
(ns laboratory.advent-code-2018
(:require [cljs.test :refer-macros [deftest is testing run-tests]]
[clojure.set]))
(declare reach-twice)
(deftest advent-code-day1-part2
(do
(is (= 0 (reach-twice [+1 -1])))
(is (= 10 (reach-twice [+3 +3 +4 -2 -4])))
@JpOnline
JpOnline / Test.md
Created April 15, 2018 13:30
Test

*** test

code?