Skip to content

Instantly share code, notes, and snippets.

function makefetchCall() {
fetch('...', {...})
.then(res => {
if (!res.ok) {
throw Error({ message: 'Response with error', code: res.status })
}
return res.json()
})
.then(json => {
@amiratak88
amiratak88 / advent.2021.3.clean.js
Last active December 3, 2021 08:05
Advent of Code 2021 - Day 3
const lines = `
101000111100
000011111101
011100000100
100100010000
.
.
.
`.trim().split('\n');
@amiratak88
amiratak88 / advent.2021.4.rb
Created December 5, 2021 04:27
Advent 2021 - Day 4
class Board
class Cell
attr_reader :row, :column, :value
def initialize(row:, column:, value:)
@row = row
@column = column
@value = value
@marked = false
end