Skip to content

Instantly share code, notes, and snippets.

@somebody1234
somebody1234 / index.html
Last active January 13, 2023 16:15 — forked from bellbind/index.html
[chrome][android] BarcodeDetector example
<!doctype html>
<html>
<head>
<script type="module">
// WICG Shape Detection API
// - https://wicg.github.io/shape-detection-api/
try {
const start = document.getElementById("start");
const video = document.getElementById("video");
const result = document.getElementById("result");
@somebody1234
somebody1234 / enemyLoot.js
Created September 25, 2020 18:09
Diamond Hunt 3 Wiki helper scripts. Use in browser console on https://dh3.diamondhunt.co/
console.log([...document.getElementById('combat-combatLog-section').children].map(child=>{const c=child.children[0].children[0].children[0],s=c.children[1].children,l=[...child.children[0].children[0].children].slice(3);return`{'${c.children[0].children[1].childNodes[0].textContent.trim().replace(/\S+/g,m=>m[0]+m.slice(1).toLowerCase())}',${s[0].children[1].textContent},${s[2].textContent},${s[4].textContent},${s[6].textContent},${s[8].textContent},{${l.map(r=>`{'${(s=>s[0].toUpperCase()+s.slice(1))(r.children[0].children[0].src.match(/\w+(?=\.png)/)[0])}',${r.children[1].innerText.includes('-')?r.children[1].innerText.split(' - ')[0]:r.children[1].innerText},${r.children[1].innerText.includes('-')?r.children[1].innerText.split(' - ')[1]:r.children[1].innerText},${r.children[2].innerText.slice(2)}}`).join(',')}}},`}).join('\n'))
@somebody1234
somebody1234 / dhmc.user.js
Last active June 1, 2020 03:35
dhm customizer
// ==UserScript==
// @name DHM Customizer
// @namespace https://diamondhunt.app/
// @version 0.0.1
// @description Customizable UI for Diamond Hunt Mobile
// @author somebody
// @match https://diamondhunt.app/
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
PREC_EXPR = {
:closed => [
[[/\G\(/, /\G\)/, -> (i) { -> (s) { i.(s) } }]]
]
}
PREC_TIMES = {
:left => [
[[/\G\*/,], -> (l, r) { -> (s) { l.(s) * r.(s) } }],
[[/\G\//,], -> (l, r) { -> (s) { l.(s) / r.(s) } }],
@somebody1234
somebody1234 / areaLoot.js
Last active September 6, 2019 00:16
Diamond Hunt Mobile Wiki helpful scripts. Use in browser console on https://diamondhunt.app
// Script to get the loot table for an area, to be placed in https://diamondhuntmobile.fandom.com/wiki/Module:Area_DB
area='hauntedMansion'; // replace with the area you're looking for, capitalized the same way.
showExploringDropRates(area+'Loot');c=s=>s[0].toUpperCase()+s.slice(1).replace(/([a-z])([A-Z])/g,'$1 $2');setTimeout(_=>console.log('{'+[...$('#dialogue-confirm-text .table-stats')[0].children[0].children].slice(1).map(e=>'{\''+c(e.children[0].children[0].src.match(/\w+(?=\.png)/)[0])+'\','+((t=e.children[1].innerText).includes('-')?t.split(' - ')[0]:t).replace(/,/g,'')+','+(t.includes('-')?t.split(' - ')[1]:t).replace(/,/g,'')+','+e.children[2].innerText.slice(2).replace('*','')+','+(!!e.children[3])+','+e.children[2].innerText.includes('*')+'}').join(',').replace(/(,false)?,false}/g,'}')+'}'),1000)
@somebody1234
somebody1234 / SnippetParser.re
Created May 4, 2019 14:22
vscode-snippet-parser
/**
* SnippetParser.re
*
* Module for parsing snippets???
*/
open CharCode;
module TokenType = {
let dollar = 0;
{
"type":"methods",
"title":"Array Methods",
"object":"A",
"intro":[],
"methods":{
"a(s/n)":{
"description":"Returns the last index of `x`s/n`` in `A`, or `-1` if not found.",
"returns":"N",
"version":"1.4.5",
bin(): n leading 1s trailing 0s
1 1 0
10 1 1
11 1 0
100 10 1
101 1 10
110 11 1
111 1 0
1000 11 1
1001 10 10
@somebody1234
somebody1234 / 32
Created August 6, 2017 04:04
Count arrays of periods
(1, 1, 1, 1, 1)
(1, 1, 1, 1, 32)
(1, 1, 1, 1, 31)
(1, 1, 1, 1, 30)
(1, 1, 1, 1, 29)
(1, 1, 1, 1, 28)
(1, 1, 1, 1, 27)
(1, 1, 1, 1, 26)
(1, 1, 1, 1, 25)
(1, 1, 1, 1, 24)
@somebody1234
somebody1234 / 32
Created August 6, 2017 04:04
Count arrays of periods
(1, 1, 1, 1, 1)
(1, 1, 1, 1, 32)
(1, 1, 1, 1, 31)
(1, 1, 1, 1, 30)
(1, 1, 1, 1, 29)
(1, 1, 1, 1, 28)
(1, 1, 1, 1, 27)
(1, 1, 1, 1, 26)
(1, 1, 1, 1, 25)
(1, 1, 1, 1, 24)