Skip to content

Instantly share code, notes, and snippets.

View syntax-punk's full-sized avatar
👀
noticing things

David syntax-punk

👀
noticing things
View GitHub Profile
@syntax-punk
syntax-punk / README.md
Created January 8, 2024 14:04 — forked from ZiKT1229/README.md
Basic Snake HTML Game

Basic Snake HTML Game

Snake is a fun game to make as it doesn't require a lot of code (less than 100 lines with all comments removed). This is a basic implementation of the snake game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

@syntax-punk
syntax-punk / pokemon-api-v1.yml
Created January 3, 2024 11:39
open api specs
openapi: 3.0.1
info:
title: KG Pokemon API
description: Pokemon API for Konrad developer onboarding.
version: 1.0.0
contact:
name: Konrad dev onboarding team
url: "https://gitlab.kgportal.com/"
servers:
- url: "http://localhost:3001/v1"
@syntax-punk
syntax-punk / TestComponents.tsx
Created December 6, 2023 15:04
"mini store" - a ridiculously simple global store implementation
import { ActionFunction, createStore } from "./ministore";
import { useStore } from "./useStore";
let store = createStore({ count: 0 });
export function ComponentA() {
const [state, setState] = useStore(store);
const inc = () => {
setState((prev) => ({
type ClassNameObject = {
[key: string]: boolean;
};
export function classnames(...values: (string | ClassNameObject | string[] | undefined)[]): string {
const result = values
.filter(Boolean) // Filter out falsy values
.reduce<string[]>((classes, next) => {
if (Array.isArray(next)) {
@syntax-punk
syntax-punk / match-priority.js
Created October 26, 2023 13:34
An Input match position priority
const cityNames = [
"Dystopya",
"Crispy Corners",
"Pyongyang",
"Pylontropolis",
"Pyramida",
"Happytown",
"Sleepy Hollow",
"Pylonville",
"Empyreal Heights"
@syntax-punk
syntax-punk / cloud firestore rules
Last active April 28, 2023 08:56
Firebase firestore access rules
/*
This rule ensures that only authenticated users with matching user IDs can read, write, and delete documents
within the todos sub-collection, and it prevents all access to any other document within the database
*/
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false
// git alias is useful for creating personal short git commands which combine several commands
// alias can be added both locally in the project (git config --local -e)
// and globally to the git user on the given machine (git config --global -e)
[alias]
adog = log --all --decorate --oneline --graph
cob = checkout -b
wip = commit -am "WIP"
undo = reset --soft HEAD~1
hdr = "!f(){ git checkout main && git pull && git checkout - && git rebase main; };f"
@syntax-punk
syntax-punk / .zsh
Last active March 3, 2021 06:42
vscode & zshrc settings
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:~/Library/Python/3.7/bin:$PATH
@syntax-punk
syntax-punk / settings.json
Created May 28, 2020 07:31
VS Code Settings
{
"workbench.colorTheme": "Night Owl",
"editor.fontSize": 14,
"editor.fontFamily": "Dank Mono, Fira Font, Consolas, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.renderWhitespace": "boundary",
"workbench.iconTheme": "vscode-icons",
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.fontLigatures": true,
@syntax-punk
syntax-punk / index-1.js
Last active May 25, 2020 18:34
AWS Lambda functions
const AWS = require("aws-sdk");
const { randomize } = require("./randomize.js");
const documentClient = new AWS.DynamoDB.DocumentClient();
exports.handler = async event => {
const { url } = JSON.parse(event.body);
const id = randomize(6);
const params = {
TableName: // dynamoDB,