{{ message }}

Instantly share code, notes, and snippets.

# Levi Lesches Levi-Lesches

Created Oct 22, 2020
LeetCode word search
View word_search.py
 class Solution: # Allows us to do "for coordinate in self" def __iter__(self): return ( (row, column) for row in range(self.rows) for column in range(self.columns) ) # Allows us to do "self [coordinate]" def __getitem__(self, coordinate): return self.board [coordinate [0]] [coordinate [1]]
Created Sep 30, 2020
A prototype of the credits page for RamLife
View credits.dart
 import "package:flutter/material.dart"; // 1. Create a Programmer class to store the right data // 2. Create a ProgrammerWidget to represent the data // 3. Create a CreditsPage widget to show all the credits // Each one of these classes can be modified reasonably without breaking the other widgets. // 1. The Programmer class defines all the data. class Programmer {
Last active Sep 25, 2020
Conway's Game of Life, demo in the comments
View Game of Life.dart
 import "dart:io"; class Position { static int rows = 13; static int columns = 13; static Set offsets = { Position(-1, -1), Position(-1, 0), Position(-1, 1), Position(0, -1), Position(0, 1), Position(1, -1), Position(1, 0), Position(1, 1),
Last active Sep 2, 2020
Scrapes headlines from the front page of nytimes.com
 import requests from bs4 import BeautifulSoup import json URL = "https://www.nytimes.com/" START_OF_JSON = "window.__preloadedData = " def get_html(): response = requests.get(URL) return response.text
Created Sep 2, 2020
 from random import choice import string alphabet = string.ascii_letters uppercaseAlphabet = alphabet.upper() symbols = string.punctuation numbers = string.digits characterSets = [alphabet, symbols, numbers, uppercaseAlphabet]
Created Jul 13, 2020
Yesterday
View yesterday.dart
 import "package:flutter/material.dart"; // -------------------- Pick your colors! ------------------- // There are two ways to make colors here: // 1. Use Color(). // The "code" is what's called a "hex color code" -- it's that 6 letter code // Except, you need to start it with "0xff". So, for example, pastel pink is: // "fdd0e4", so "pastelPink" (below) is "Color(0xfffdd0e4)". These color codes // can be taken from anywhere (try Googling "hex color picker")
Created Apr 19, 2020
A Python implementation of Battleship (deliberately avoiding OOP)
View battleship.py
 """ Battleship Concepts used: - constants - functions (I/O) - if on one line - random.choice and random.shuffle - printing with an `end` - tuples
Created Mar 3, 2020
Searches for class in schedule
View schedule_search.dart
 void main() { for (int i = 0; i < 5; i++) { print('hello \${i + 1}'); } } Map> getSubjectInSchedule() {} class Subject {
Created Feb 21, 2020