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 re | |
word_numbers = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] | |
real_numbers = [str(i) for i in range(1, 10)] | |
numbers_re = "|".join(real_numbers + word_numbers) | |
first_re = rf"^.*?({numbers_re}).*$" | |
last_re = rf"^.*({numbers_re}).*?$" |
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 re | |
import subprocess | |
DIVIDER_RE = r"^.+\s+[0-9a-f]+$" | |
ITEM_RE = r"^.+\s+.+\s+.*$" | |
def get_line_changes_over_time(): | |
process = subprocess.Popen( | |
[ |
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
from typing import Optional | |
class ListNode: | |
def __init__(self, x): | |
self.val = x | |
self.next = None | |
def list(l: list) -> Optional[ListNode]: |
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
let width = 800; | |
let height = 800; | |
let xdots = 30; | |
let ydots = 30; | |
class Turtle { | |
constructor(position) { | |
this.position = position; | |
this.direction = createVector(0, -1); | |
this.color = color(255, 255, 255); |
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
let width = 800; | |
let height = 600; | |
let particles = []; | |
class Particle { | |
constructor(position, velocity, color) { | |
this.position = position; | |
this.velocity = velocity; | |
this.color = color; | |
} |
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
require 'set' | |
class Node | |
attr_accessor :value, :parent | |
def initialize(value = nil, parent = nil) | |
@is_word = false | |
@parent = parent | |
@value = value | |
@children = {} |
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
from typing import List | |
class Item: | |
name: str | |
degradation: int = 1 | |
quality_min: int = 0 | |
quality_max: int = 50 | |
def __init__(self, name: str, sell_in: int, quality: int): |
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
#!/usr/bin/env python | |
import enum | |
from random import randrange | |
from typing import Optional | |
class QuestionGenerator: | |
def __init__(self, category: str) -> None: | |
self.category = category |
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 random | |
import enum | |
from typing import List, Optional | |
class Value(enum.IntEnum): | |
ACE = 11 | |
TWO = 2 | |
THREE = 3 | |
FOUR = 4 |
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 std::io::stdout; | |
use std::{io::Write, time::SystemTime}; | |
use std::{thread::sleep, time::Duration}; | |
fn main() { | |
let sleep_duration = Duration::from_millis(1); | |
loop { | |
sleep(sleep_duration); | |
let now = SystemTime::now(); | |
if let Err(e) = now.elapsed() { |
NewerOlder