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
import 'dart:io'; | |
import 'package:console/console.dart'; | |
// ignore: unused_import | |
import 'package:more/more.dart'; | |
// ignore: unused_import | |
import 'package:collection/collection.dart'; | |
List<int> parseLine(String l) => l.split('').map(int.parse).toList(); |
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
<h1 id="header">Advent of Code 2021 Day 25</h1> | |
<div id="wrapper"> | |
<canvas id="canvas" width="417" height="411"></canvas> | |
</div> | |
<p id='status'>Run me</p> | |
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
/// Given a grid of (real) trees of different heights | |
/// 1) Find how many are visible from any edge | |
/// 2) Find the best view from any trees (= product of distances) | |
import 'package:collection/collection.dart'; | |
//import 'package:more/more.dart'; | |
// Hack for missing `more` library |
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
import 'dart:async'; | |
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
// Hack for missing `more` library | |
extension IntegerRangeExtension on int { | |
List<int> to(int end) => List.generate(end - this, (i) => i + this); | |
} |
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
/// Parse an AoC output to find the 6x4 letters encoded in it. | |
/// Takes a list of bools and produces the resulting string. | |
readLetters(List<bool> l) { | |
var hexes = l | |
// Split into 5-element chunks. | |
.chunked(5) | |
// Remove the last element of each chunk. | |
.map((e) => e.take(4)) | |
// Convert to the equivalent binary, then convert that to a hex digit. | |
.map((e) => e.fold(0, (s, t) => s * 2 + (t ? 1 : 0)).toRadixString(16)) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="scaffolded-by" content="https://github.com/dart-lang/sdk"> | |
<title>aoc2022_day12</title> | |
<link rel="stylesheet" href="styles.css"> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="scaffolded-by" content="https://github.com/dart-lang/sdk"> | |
<title>aoc2022_day12</title> | |
<link rel="stylesheet" href="styles.css"> |
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
// Use the contents of your GDPR comments.csv file to edit all | |
// of your Reddit history. You can request this history at: | |
// https://www.reddit.com/settings/data-request | |
// They don't check whether you're actually an EU citizen :-) | |
// It uses puppeteer to remotely control a (headless) Chrome browser | |
// If you have a massive history or you posted in many subs that | |
// are now private you may want to refine the script's error | |
// handling which is currently just to dump failed edits to stdout. |
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
{ | |
"@@locale": "cy", | |
"settings": ">>>Settings", | |
"general": ">>>General", | |
"accounts": ">>>Accounts", | |
"blocks": ">>>Blocks", | |
"appearance": ">>>Appearance", | |
"post_style": ">>>Post Style", | |
"comment_style": ">>>Comment Style", | |
"add_account": ">>>Add account", |
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
/// Play Rock Paper Scissors | |
/// 1) By playing the given move. | |
/// 2) By playing for the desired result. | |
/// https://dartpad.dev/?id=96a60324a73eb1dc73d0d9378af0068c | |
import 'package:collection/collection.dart'; | |
var scores = { | |
'AX': 1 + 3, | |
'AY': 2 + 6, | |
'AZ': 3 + 0, |
OlderNewer