Skip to content

Instantly share code, notes, and snippets.

View LukeberryPi's full-sized avatar

LukeberryPi LukeberryPi

View GitHub Profile
@LukeberryPi
LukeberryPi / cv.tex
Created July 1, 2024 23:14
my cv NO INFO
\documentclass[a4paper,10pt]{article}
\usepackage[margin=0.5in,nofoot]{geometry}
\usepackage{fontawesome5}
\usepackage{hyperref}
\usepackage{titlesec}
\usepackage{xcolor}
\hypersetup{
colorlinks=true,
linkcolor=blue,
@LukeberryPi
LukeberryPi / useDebounce.ts
Created June 24, 2024 15:21
simple useDebounce hook
import { useEffect, useState } from 'react';
export default function useDebounce(value: string, delay: number) {
const [debouncedValue, setDebouncedValue] = useState(value);
useEffect(() => {
const handler = setTimeout(() => {
setDebouncedValue(value);
}, delay);
@LukeberryPi
LukeberryPi / settings.json
Last active June 20, 2024 22:51
my vscode setup
{
"workbench.colorTheme": "Vesper",
"workbench.iconTheme": "chalice-icon-theme",
"editor.fontSize": 15,
"editor.fontWeight": "300",
"terminal.explorerKind": "external",
"terminal.integrated.fontSize": 20,
"terminal.integrated.fontWeight": "300",
"editor.glyphMargin": false,
"editor.fontFamily": "JetBrains Mono",
@LukeberryPi
LukeberryPi / createRange.js
Created May 29, 2024 23:06
create range javascript function
const createRange = (len, start = 1) =>
Array(len)
.fill(0)
.map((_, i) => i + start);
@LukeberryPi
LukeberryPi / index.js
Created March 9, 2024 22:01
enable copy and past on any website
javascript:(function(){
allowCopyAndPaste = function(e){
e.stopImmediatePropagation();
return true;
};
document.addEventListener('copy', allowCopyAndPaste, true);
document.addEventListener('paste', allowCopyAndPaste, true);
document.addEventListener('onpaste', allowCopyAndPaste, true);
})();
@LukeberryPi
LukeberryPi / utils.js
Last active March 5, 2024 01:32
isMobile utils
export const isTouchable = () => {
const userAgent = window.navigator.userAgent;
return (
!!userAgent && userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i)
);
};
export const isIphone = () => {
return (
!!navigator.platform &&
@LukeberryPi
LukeberryPi / settings.json
Last active March 4, 2024 20:50
my zed settings
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
"features": {
@LukeberryPi
LukeberryPi / settings.json
Created March 3, 2024 06:37
vscode-settings
{
"files.autoSave": "onFocusChange",
"editor.formatOnSave": true,
"workbench.colorTheme": "Gruvbox Dark Medium",
"workbench.iconTheme": "gruvbox-material-icon-theme",
"editor.fontSize": 16,
"terminal.integrated.fontSize": 16,
"explorer.confirmDragAndDrop": false,
"editor.minimap.enabled": false,
"breadcrumbs.enabled": false,
@LukeberryPi
LukeberryPi / solution.js
Last active April 15, 2024 10:50
Do not access Object.prototype method 'hasOwnProperty' from target object. It is a 'no-prototype-builtins' error.
// if you have a javascript object and want to check if it has a key (property)
const obj = {
"a": 1,
"b": 2,
"c": 3,
}
// checking directly from the object might piss off ESLint
obj.hasOwnProperty("c"); // 'no-prototype-builtins' error.
@LukeberryPi
LukeberryPi / areAdjacent.js
Last active December 19, 2023 01:04
function that returns if two coordinates are adjacent in javascript
function areAdjacent(coord1, coord2) {
const [x1, y1] = coord1;
const [x2, y2] = coord2;
const isHorizontallyAdjacent = Math.abs(x1 - x2) === 1 && y1 === y2;
const isVerticallyAdjacent = x1 === x2 && Math.abs(y1 - y2) === 1;
const isDiagonallyAdjacent =
Math.abs(x1 - x2) === 1 && Math.abs(y1 - y2) === 1;
return isHorizontallyAdjacent || isVerticallyAdjacent || isDiagonallyAdjacent;