Skip to content

Instantly share code, notes, and snippets.

View nmay231's full-sized avatar

Noah nmay231

  • 04:36 (UTC -05:00)
View GitHub Profile
@nmay231
nmay231 / App.js
Last active December 5, 2019 04:35
`onChange()` not being called
import React from "react";
import "./App.css";
function App() {
const [current, setCurrent] = React.useState(1);
const options = [1, 2, 3];
const handleChange = e => {
console.log(e.target);
setCurrent(parseInt(e.target.value));
@nmay231
nmay231 / index.html
Created December 4, 2019 23:19
Vanilla Bootstrap still works
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
import discord
import chess
token = "It's a secret *wink wink*"
class ChessClient(discord.Client):
def __init__(self):
super().__init__()
self.chess_board = None
self.players = None
@nmay231
nmay231 / build_schema.sql
Created May 6, 2020 00:47
better-sqlite3 trigger bug
CREATE TABLE Test (
id integer primary key autoincrement,
data text not null,
_last_updated datetime default current_timestamp
);
CREATE TRIGGER update_test_timestamp
AFTER UPDATE ON Test BEGIN
UPDATE Test SET _last_updated = datetime("now") WHERE id = new.id;
END;
@nmay231
nmay231 / knights_tour.py
Last active November 20, 2020 09:01
Knights Tour Example
#!/usr/bin/env python3
"""
A puzzle game based on the Knight's Tour problem.
Requires Python 3.6+ and PyGame ($ pip3 install pygame)
Instructions:
* Left-click to move a knight's move away from the starting cell (highlighted blue)
* Right-click anywhere to undo