Skip to content

Instantly share code, notes, and snippets.

function nextRow(i) {
var rows = document.querySelectorAll("#tabAllGrid .row-wrapper");
console.log(i);
// if(i>2){return;}
var cells = Array.from(rows).map((r) =>
r.querySelector(".gridCell:first-child .cell-wrapper")
);
@mold
mold / combine-latest-to-object.ts
Last active August 21, 2022 20:46
An rxjs combineLatest that takes an object of key/observable pairs and emits an object of key/values when any of the inner observables emits (typescript).
import { combineLatest, noop, Observable } from 'rxjs';
import { debounceTime, map, shareReplay, startWith, tap } from 'rxjs/operators';
export interface OperatorDict<X> {
[key: string]: Observable<X> | [Observable<X>, X];
}
/**
* Extracts the type `T` of an `Observable<T>`
*/
@mold
mold / get-float-value.js
Created September 12, 2018 12:23
Converting a 4-byte float (IEEE-11073) to a JavaScript number
/**
* Converts a DataView that represents a 4 byte float (IEEE-11073)
* to an actual float. Useful for example when reading temperature
* from a Bluetooth thermometer :)
*
* The DataView buffer should contain at least 4 bytes:
*
* [b0, b1, b2, b3]
* ^ ^ ^ └---------- Exponent
* └---└---└------- Will become the mantissa
// ==UserScript==
// @name Drive Number of Files
// @namespace dkdscripts
// @version 1.0
// @description Shows how many items are displayed currently in drive (updates 1/s)
// @author dkd
// @downloadURL https://gist.github.com/mold/d30f5650273e43718530/raw/9dbb8d3949945e278563b01d40a277a72506f58f/drive-num-files.user.js
// @match https://drive.google.com/*
// @grant none
// ==/UserScript==
@mold
mold / tvunblock.sh
Created December 7, 2015 22:52
Set DNS to TVUnblock servers
#!/bin/bash
if [ $UID -ne 0 ] ; then
printf "Usage: sudo ./tvunblock.sh\n"
exit
fi
SERVERS="nameserver 46.101.149.135\nnameserver 46.101.36.120"
OLD="$(cat /etc/resolv.conf)"
@mold
mold / sidemenuexample
Created June 24, 2015 13:22
Fixed side menu example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>TEST :)</title>
<link rel="stylesheet" href="">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" type="text/javascript"></script>
<style type="text/css">
html,body{
@mold
mold / JsFormat.sublime-settings
Last active August 29, 2015 13:56
JSFormat options á la dannemannenene
{
// exposed jsbeautifier options
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 4,
"space_in_paren": false,
"jslint_happy": false,
"brace_style": "collapse",
"keep_array_indentation": true,
"keep_function_indentation": false,