Skip to content

Instantly share code, notes, and snippets.

View michaelpb's full-sized avatar
🍜
.

michaelb michaelpb

🍜
.
View GitHub Profile
@michaelpb
michaelpb / pysnek_example.py
Last active July 24, 2023 23:49
A simple snake-like game using Python Turtle Graphics
import turtle
import random
snake_turtle = turtle.Pen()
snake_turtle.penup()
snake_turtle.shape('square')
snake_turtle.shapesize(1, 3)
snake_turtle.color('orange')
import turtle
import random
turtle.bgcolor('black')
turtle.colormode(255)
t = turtle.Pen()
t.speed('fast')
t.pensize(8)
for counter in range(500):
x = random.randint(-200, 200)
y = random.randint(-200, 200)
@michaelpb
michaelpb / wordguesser.py
Created July 24, 2023 23:46
word guesser
import random
lives = 9
words = [
'photos',
#'antidisestablishmentarianism',
'pogostick',
]
guessed_letters = []
secret_word = random.choice(words)
clue = list(secret_word)
import random
import time
from tkinter import Tk, Canvas, HIDDEN, NORMAL
root = Tk()
root.title('Snap Game')
c = Canvas(root, width=400, height=400)
shapes = [ ]
circle = c.create_oval(35, 20, 365, 360, outline='black',
fill='black', state=HIDDEN)
shapes.append(circle)
@michaelpb
michaelpb / egg_catching_game.py
Created July 24, 2023 23:43
Egg catching game in Tkinter
import random
import time
from tkinter import Tk, Canvas
root = Tk()
root.title('Egg Catching Game')
c = Canvas(root, width=400, height=600,
background='light blue')
<State
username="Samantha"
></State>
<StaticData
src="https://jsonplaceholder.typicode.com/users"
></StaticData>
<Script>
function renderCallback({ component, staticdata, state}) {
console.log(staticdata);
        component.innerHTML = `
@michaelpb
michaelpb / deepmap.js
Created November 24, 2021 15:53
Deep Map - a data type that allows "deeply nested" objects that can be "sliced" into flat objects at any "level" (e.g. an object with "me.stuff" and "me.thing" keys could extract a "me" object that has "stuff" and "thing" properties)
const test = require('ava');
// Deep Map - a data type that allows "deeply nested" objects that can be "sliced" into flat objects at any "level" (e.g. an object with "me.stuff" and "me.thing" keys could extract a "me" object that has "stuff" and "thing" properties)
function isPlainObject(obj) {
return obj && typeof obj === 'object' && !Array.isArray(obj);
}
class DeepMap {
constructor(copyFrom=null, autoSave=false) {
this.label = null;
"virtualenvtool" or "venvtool"
# config:set
Okay, a new standard to replace dotenv:
venvtool config:set THING=100
@michaelpb
michaelpb / index.html
Created May 23, 2020 18:03 — forked from neurodynamic/index.html
Add React in One Minute
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Scooby-dUber - Uber for Dogs</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
</head>