Skip to content

Instantly share code, notes, and snippets.

function infiniteScroll() {
let responseBuffer = [];
let hasMore;
let requestPending = false;
const loadingButtonEl = document.querySelector('#infinite-scroll-button');
const containerEl = document.querySelector('#infinite-scroll-container');
const sentinelEl = document.querySelector("#sentinel");
const insertNewItems = () => {
while (responseBuffer.length > 0) {
const data = responseBuffer.shift();
@eguneys
eguneys / extract.sh
Created June 18, 2023 20:29
extract files in all folders into a single folder.
tmp_dir="/tmp/xyz_data"
mkdir -p "$tmp_dir"
for folder in "$source_dir"/*; do
if [ -d "$folder" ]; then
folder_name=$(basename "$folder")
cp "$folder"/* "$tmp_dir"
fi
done
@eguneys
eguneys / evals_pack1.csv
Created January 5, 2023 05:31
Position evaluations for pack 1 aidchess
We can't make this file beautiful and searchable because it's too large.
starter,CsXVlvOU,-0.4,10,rn1qkb1r/1bpp1ppp/p3pn2/1p6/4P3/1B1P1Q2/PPP2PPP/RNB1K1NR w KQkq - 1 6
starter,CsXVlvOU,2.93,30,r4qk1/bbpp1p2/p3p1p1/4n2n/Np2PNQ1/1B1P4/PPP2PPP/R3R1K1 w - - 2 16
starter,CsXVlvOU,-3.09,50,5rk1/bbp5/4pn2/3p2p1/Np2P3/1B1P2Pn/PP1R1P2/5RK1 w - - 0 26
starter,l507na9y,0.21,20,2kr2nr/ppqn1ppp/2pbp1b1/8/6P1/2NPB2P/PPP1NPB1/R2QK2R w KQ - 5 11
starter,l507na9y,2.23,60,1k2r3/1p3p2/p1p1q1p1/4n1P1/3p1Q2/P2P4/1PP2P2/1K1B3R w - - 2 31
starter,QkLEiCXJ,-1.22,30,2k3nr/1pprppbp/p4qp1/3P4/5P2/2N5/PPPB2PP/R2Q1RK1 w - - 0 16
starter,pU5CpQbo,1.25,10,r1bqkb1r/p2pnppp/2p1p3/2p5/4PP2/5N2/PPPP2PP/RNBQK2R w KQkq - 2 6
starter,4Lsb61tK,-2.3,20,r2q1rk1/1pp2p1p/pbnp1np1/4p3/1PB1P3/P1NP1NPb/2P2P2/R1BQ1RK1 w - - 0 11
starter,2x02uG3n,0.12,10,rnb1k2r/pp1pppbp/1q3np1/2p5/3P1B2/2P1PN2/PP3PPP/RN1QKB1R w KQkq - 1 6
starter,2x02uG3n,-0.45,60,1b6/1p3k1p/4n1p1/5p2/1PN5/5PPP/2N1K3/8 w - - 3 31
@eguneys
eguneys / usave.sh
Created September 9, 2022 14:30
Build Aseprite Copy into folder
#!/bin/bash
FOLDER=$1
OUT=$2
OPTIPNG="/mnt/d/programs/optipng-0.7.7-win32/optipng.exe"
ASEPRITE="/mnt/c/Program Files/Aseprite/aseprite.exe"
files="sprites
sprites2
font_sprites"
// Simple Tween Snippet with Solid.js API
// Usage
/*
import { tween, update, read } from './anim'
// duration
let ticks = { sixth: 6/60 }
// tween values
let radius = 100
this._rt = tween([0.8, 0.8, 1, 0.2].map(_ => _ * radius), [ticks.sixth, ticks.sixth, ticks.sixth])
@eguneys
eguneys / tiesegment.svg
Created March 22, 2022 23:31
tiesegment
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eguneys
eguneys / pixelsave.sh
Created February 7, 2022 22:16
Pixel Save
#!/bin/bash
FOLDER=$1
OUT=$2
OPTIPNG="D:/programs/optipng-0.7.7-win32/optipng.exe"
ASEPRITE="C:/Program Files/Aseprite/aseprite.exe"
files="sprites
sprites2"
@eguneys
eguneys / cardstack.lua
Last active December 22, 2021 01:06
Card Stack Example
function has_card_and_pos(card, x, y)
return { card=card, pos = { x, y } }
end
function draw_card(hascardandpos)
love.graphics.print(hascardandpos.card, hascardandpos.pos[1], hascardandpos.pos[2])
end
function cardstack_and_pos(x, y)
@eguneys
eguneys / gist:96e8f8ce701e0ae2fb4743e2b13f0ed4
Last active November 1, 2021 23:33
Top down movement in pico8
-- if you find this interesting
-- checkout the full source code at https://github.com/eguneys/pico8-jam/blob/master/alta.p8
local intheta = atan2(-ix, -iy)
local diftheta = player.theta - intheta
if ix ~= 0 or iy ~= 0 then
player.theta = appr(player.theta, intheta, 0.08)
if abs(diftheta) < 0.25 then
@eguneys
eguneys / gist:e165087f569e598ded9904e9a4d27cdb
Last active January 8, 2020 12:55
ConcurrentHashMap to Scala List
import java.util.concurrent.ConcurrentHashMap
import scala.jdk.CollectionConverters._
var masas = new ConcurrentHashMap[Masa.ID, Masa]()
def publicCreated: List[Masa] = masas.values.asScala.toList