Skip to content

Instantly share code, notes, and snippets.

View larsaars's full-sized avatar
🌻
right here

lars larsaars

🌻
right here
View GitHub Profile
@larsaars
larsaars / BFS_DFS.java
Last active October 27, 2020 13:48
Uniformed Search for a graph: BFS (Breadth First Search) and DFS (Depth First Search) in Java
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Objects;
public class BFS_DFS {
public static void main(String[] args) {
//prepare some nodes
char[] alphabet = ("abcdefghijklmnopqrstuvwxyz").toCharArray();
Node[] ns = new Node[alphabet.length];
@larsaars
larsaars / fancy_button.dart
Last active November 12, 2020 01:37
a fancy button with animations for dart
import 'package:flutter/material.dart';
class FancyButton extends StatefulWidget {
final VoidCallback onPressed;
final String text;
final IconData icon;
final Color splashColor, fillColor, iconColor;
FancyButton({Key key, @required this.onPressed, this.text = "", this.icon, this.splashColor = Colors.orange, this.fillColor = Colors.brown, this.iconColor = Colors.amber}) : super(key: key);
@larsaars
larsaars / print_text_box.py
Created April 19, 2021 13:28
print a text box with python
def text_box(width: int, height: int) -> str:
lx, ly = width - 1, height - 1
out = ''
for y in range(height):
for x in range(width):
if x == 0 or x == lx:
out += '+' if y == 0 or y == ly else '|'
elif y == 0 or y == ly:
out += '-'
else: