Skip to content

Instantly share code, notes, and snippets.

View 3rdp's full-sized avatar

Alex Davydenko 3rdp

  • Ukraine
View GitHub Profile
@3rdp
3rdp / gist:dca687639249025cb270bb82cb5b929d
Last active August 22, 2021 11:30
redbean 1.4 cache bug (seems to affect all html files except index.html)
going to update the file
D2021-08-22T03:52:47.871283:tool/net/redbean.c:1839:redbean-1:74710] indexing assets (inode 0xf79b5b)
cmd+r
D2021-08-22T03:53:06.587155:tool/net/redbean.c:5353:redbean-1:74731] 127.0.0.1:63870 LOOPBACK read 618 bytes
I--------------------000027:tool/net/redbean.c:4949:redbean-1:74731] RECEIVED 127.0.0.1:63870 LOOPBACK HTTP11 GET http://localhost:8080/hello.html "http://localhost:8080/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0"
D--------------------000006:tool/net/redbean.c:4984:redbean-1:74731] RoutePath("/localhost/hello.html")
D--------------------000003:tool/net/redbean.c:4984:redbean-1:74731] RoutePath("/www.localhost/hello.html")
@3rdp
3rdp / nocommit.sh
Last active April 16, 2021 15:22
no commit comment check in pre-commit hook
# NO COMMIT ;)
for FILE in `git diff --name-only --cached` ; do
if grep -q 'NO COMMIT' $FILE
then
echo $FILE ' contains NO COMMIT!'
exit 1
fi
done
exit
function timeSince(timeStamp) {
var now = new Date(),
secondsPast = (now.getTime() - timeStamp.getTime()) / 1000;
if(secondsPast < 60){
return [-parseInt(secondsPast), 'seconds']
}
if(secondsPast < 3600){
return [-parseInt(secondsPast/60), 'minutes']
}
if(secondsPast <= 86400){
@3rdp
3rdp / README.md
Created March 22, 2020 10:13
get dependencies of a package in a monorepo

Motivation

I have this awesome tool madge. I do

madge --extensions ts,tsx,js,jsx --json .

to get a nice view of local (read non-NPM) dependencies.

I have this awesome tool depcruise. I do

@3rdp
3rdp / sgdq-2019.txt
Created July 2, 2019 13:17
schedule from sgdq 2019; a neat list of games
Games Done Quick
Event Info
Community Info
About Us
Discord
VODS
HOTFIX
#!/bin/bash
ALARM='today 22:45'
SOUND='/home/sasha/Музика/'
sudo rtcwake -d rtc0 -m mem -t $(date +%s -d "$ALARM") -v && vlc -L $SOUND
{
"name": "hooks-chat",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1",
"use-immer": "^0.3.3",
"use-socket.io-client": "^1.0.4"
@3rdp
3rdp / problem.js
Last active June 26, 2019 08:44
Hitting hobbits for the first time
/** You need to add right body parts */
const asymHobbitBodyParts = [{name: "head", size: 3},
{name: "left-eye", size: 1},
{name: "left-ear", size: 1},
{name: "mouth", size: 1},
{name: "nose", size: 1},
{name: "neck", size: 2},
{name: "left-shoulder", size: 3},
{name: "left-upper-arm", size: 3},
{name: "chest", size: 10},
@3rdp
3rdp / pre-commit.sh
Last active June 6, 2019 06:52 — forked from gerad/pre-commit.sh
git pre-commit hook that checks for debugger / console.log
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, make this file executable.
if git-rev-parse --verify HEAD 2>/dev/null