Skip to content

Instantly share code, notes, and snippets.

View holiday_protect.sh
evenings_ok=(
"Pesach I"
"Pesach VII"
"Shavuot I"
"Tish'a B'Av"
"Rosh Hashana II"
"Yom Kippur"
"Sukkot I"
"Shmini Atzeret"
)
View demo.sql
CREATE TABLE test (x integer, y integer);
INSERT INTO test(x, y) VALUES(10, 20);
INSERT INTO test(x, y) VALUES(10, 20);
INSERT INTO test(x, y) VALUES(10, 20);
@ynonp
ynonp / clojurescript-useeffect.cljs
Created Feb 18, 2022
ClojureScript useEffect example
View clojurescript-useeffect.cljs
(ns reagent-useeffect-demo.core
(:require
[reagent.core :as r]
[react :as react]
[cljs.core.async :refer [go]]
[cljs.core.async.interop :refer-macros [<p!]]
[reagent.dom :as rdom]))
(defn use-pokemon [id]
(let [[data set-data] (react/useState {})
View vue-lab.md

Lab: Hello Vue

[ ] Create a first Vue app in Vite. Change the text to show your name.

[ ] Change the background color to a color you like

[ ] Add a new component that prints Hello <your name>. Add it to the page multiple times to see the message repeated.

[ ] Add a new component that shows an image.

View .env
# App port to run on
PORT=3000
# The name of the site where Kutt is hosted
SITE_NAME=Kutt
# The domain that this website is on
DEFAULT_DOMAIN=localhost:3000
# Generated link length
View aoc2020_day22_2.ex
defmodule Day22_2 do
def read_input do
File.read!("input/day22.txt")
|> String.split("\n\n", trim: true)
|> Enum.map(fn deck_str ->
deck_str
|> String.split("\n", trim: true)
|> Enum.drop(1)
|> Enum.map(&String.to_integer/1)
end)
View aoc2020day21.ex
defmodule Day21 do
def read_input do
File.read!("input/day21.txt")
|> String.split("\n", trim: true)
end
def ingredients_list(line) do
[ingredients_str, _alergens_str] = String.split(line, [" (contains ", ")"], trim: true)
String.split(ingredients_str, " ", trim: true)
end
View aoc2020day18.ex
defmodule Day18 do
def read_input do
File.read!("input/day18.txt")
|> String.split("\n", trim: true)
end
def solve_part2(expr) do
cond do
String.contains?(expr, "(") ->
Regex.replace(~r/\(([^()]+)\)/, expr, fn _, expr -> solve_part2(expr) end)
View aoc2020_day17_part1.ex
defmodule Day17 do
def read_input do
File.read!("input/day17.txt")
|> String.split("\n", trim: true)
|> Enum.map(&String.graphemes/1)
|> Enum.map(&Enum.with_index/1)
|> Enum.with_index
|> Enum.flat_map(fn {line, row} -> Enum.map(line, fn {el, col} -> {{row, col, 0}, el } end) end)
|> Enum.into(%{})
end