Skip to content

Instantly share code, notes, and snippets.

View seleb's full-sized avatar
👁️

Sean S. LeBlanc seleb

👁️
View GitHub Profile
function wait(t) {
return new Promise(resolve => setTimeout(resolve, t));
}
const tracks = Array.from(document.querySelectorAll(".trackManagerTrackList__item"));
for (track of tracks) {
const moreBtn = track.querySelector('.sc-button-more');
moreBtn.click();
await wait(500 + Math.random(500));
const downloadBtn = document.querySelector('.sc-button-download');
@seleb
seleb / interlace.js
Created October 21, 2019 04:28
bitsy custom exit effect
{
showPlayerStart: true,
showPlayerEnd: true,
duration: 180,
frameRate: 60,
pixelEffectFunc: function (start, end, pixelX, pixelY, delta) {
var a = start.Image.GetPixel(pixelX, pixelY);
var b = end.Image.GetPixel(pixelX, pixelY);
var w = bitsy.tilesize * bitsy.mapsize;
if (pixelY % 2) {
@seleb
seleb / tile wipe.js
Created October 21, 2019 04:08
bitsy custom exit effect
{
showPlayerStart: true,
showPlayerEnd: true,
duration: 500,
frameRate: 30,
pixelEffectFunc: function (start, end, pixelX, pixelY, delta) {
var a = start.Image.GetPixel(pixelX, pixelY);
var b = end.Image.GetPixel(pixelX, pixelY);
var r = a;
let tileX = Math.floor(pixelX / bitsy.tilesize);
@seleb
seleb / strip-to-fnt.js
Created July 14, 2019 23:08
generates xml font descriptor for a monospaced strip
const height = 6;
const width = 4;
const result = `<?xml version="1.0"?>
<font>
<info size="${Math.max(width, height)}"/>
<common lineHeight="${height}" base="${height}"/>
<chars count="255">
${new Array(255).fill(0).map((_, idx) => `<char id="${idx}" x="${idx*width}" y="0" width="${width}" height="${height}" xoffset="0" yoffset="0" xadvance="${width}" />`).join('\n')}
</chars>
@seleb
seleb / bitsy-ish.css
Last active November 20, 2019 05:17
stylesheet with some css to roughly match the bitsy editor components
* {
box-sizing: border-box;
font-family: sans-serif;
}
html,
body,
form {
margin: 0;
padding: 0;
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
@seleb
seleb / alphabetize obj.js
Created March 29, 2019 15:29
alphabetize an object and copy the result to the clipboard
const obj = {
// your obj here
};
copy(Object.entries(obj).sort(([a], [b])=>a.localeCompare(b)).reduce((r, [k, v]) => ({...r, [k]: v}), {}));
@seleb
seleb / bitsork.html
Created March 21, 2019 05:58
bitsy + text parser demo
<!DOCTYPE HTML>
<html>
<!-- HEADER -->
<head>
<title>Write your game's title here</title>
<script type="bitsyGameData" id="exportedGameData">
Write your game's title here
@seleb
seleb / unique words.js
Created November 29, 2018 00:17
get array of unique words in list
var l = ['word','list']
copy(
Object.keys(
l.reduce(
(res, word)=>({
...res,
[word]:true
}),
{}
)
@seleb
seleb / bitsy tile loop.js
Created June 4, 2018 04:50
create gamedata for a looping bitsy tile animation
////////////
// config //
////////////
const tileStr = `
00000000
00000000
00100100
00100100
00000000
01000010