This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper used to replace code in a script tag based on a search regex. | |
* To inject code without erasing original string, using capturing groups; e.g. | |
* ```js | |
* inject(/(some string)/,'injected before $1 injected after'); | |
* ``` | |
* @param searcher Regex to search and replace | |
* @param replacer Replacer string/fn | |
*/ | |
function inject(searcher, replacer) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const shader = ` | |
precision mediump float; | |
uniform sampler2D tex0; | |
uniform sampler2D tex1; | |
uniform float time; | |
uniform vec2 resolution; | |
const float PI = 3.14159; | |
vec2 uBufferSize = vec2(128, 128); | |
//https://stackoverflow.com/questions/12964279/whats-the-origin-of-this-glsl-rand-one-liner | |
float rand(vec2 co){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Play this game by pasting the script in http://www.puzzlescript.net/editor.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const img = document.querySelector('img'); | |
const size = [img.width, img.height]; | |
const options = { | |
background: 'black', | |
scaleMode: 'MULTIPLES', | |
allowDownscaling: true, | |
disableFeedbackTexture: false, | |
scaleMultiplier: 8, | |
fragment: ` | |
precision mediump float; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// avatar utils (mostly copied from blitsy) | |
function encodeM1(pixels) { | |
var pixels32 = new Uint32Array(pixels); | |
var data = new Uint8ClampedArray(Math.ceil(pixels32.length / 8)); | |
for (var i = 0; i < data.length; ++i) { | |
var byte = 0; | |
for (var bit = 0; bit < 8; ++bit) { | |
byte <<= 1; | |
byte |= pixels32[i * 8 + (7 - bit)] > 0 ? 1 : 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getCollectionUrls(collectionName) { | |
// find collection | |
const collection = Array.from(document.querySelectorAll('.game_collection')).find(i => { | |
const titleEl = i.querySelector('.collection_title_wrap'); | |
return titleEl && titleEl.innerText.toLowerCase() === collectionName.toLowerCase(); | |
}); | |
if (!collection) { | |
throw new Error(`Could not find collection "${collectionName}`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[lang='zh-CN'], | |
[lang='zh-Hant'], | |
[lang='ko'], | |
[lang='ja'] { | |
word-break: keep-all; | |
overflow-wrap: break-word; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
script for exporting roll20 maps to an image | |
how to use: | |
1. open your roll20 game to the page you want to save | |
2. open your browser's developer tools | |
3. copy-paste this entire file in the console | |
4. hit enter | |
5. wait for map to save and appear in top-left | |
6. right-click -> save as... to export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bitsy from 'bitsy'; | |
import { inject } from '@bitsy/hecks/src/helpers/kitsy-script-toolkit'; | |
import { | |
hackOptions as canvasReplacement | |
} from '@bitsy/hecks/src/canvas replacement'; | |
canvasReplacement.glazyOptions.fragment = ` | |
precision mediump float; | |
uniform sampler2D tex0; | |
uniform sampler2D tex1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
NewerOlder