Skip to content

Instantly share code, notes, and snippets.

@370417
370417 / spinner.css
Last active September 15, 2021 01:50
Lichess logo spinner
.spinner {
background: no-repeat center url("data:image/svg+xml;utf8,%3Csvg%20viewBox%3D'-2%20-2%2054%2054'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%3Cmask%20id%3D'a'%3E%3Cpath%20id%3D'c'%20pathLength%3D'1'%20fill%3D'none'%20stroke%3D'white'%20stroke-width%3D'3.77953'%20stroke-dasharray%3D'1'%20d%3D'm%2021.776255%2C12.644596%20c%20-1.28368%2C8.43561%208.943332%2C12.698588%2014.537976%2C17.606142%203.000307%2C2.631832%204.41181%2C4.442404%205.683988%2C7.930417'%20%2F%3E%3Cpath%20id%3D'd'%20pathLength%3D'1'%20fill%3D'none'%20stroke%3D'white'%20stroke-width%3D'4.15748'%20stroke-dasharray%3D'1'%20d%3D'M%2043.186954%2C36.323824%20C%2046.003963%2C35.12034%2049.845597%2C30.841626%2048.627889%2C28.700886%2046.377142%2C24.744054%2039.744879%2C14.01233%2036.740396%2C8.9693395%2036.318664%2C8.2614666%2036.497278%2C7.1347125%2037.33348%2C5.6694471%2038.691731%2C3.2894037%2039.28973%2C0.04112172%2039.28973%2C0.04112172'%20%2F%3E%3Cpath%20id%3D'e'%20pathLength%3D'1'%20fill%3D'none'%20stroke%3D'white'%20strok
@370417
370417 / chessground.d.ts
Created August 12, 2021 02:32
Types for chessground 4.4.1
type Chessground = {
/** reconfigure the instance */
set(
options: Exclude<
Options,
{
viewOnly: boolean;
minimalDom: boolean;
}
>
@370417
370417 / lichess-no-skip.css
Created July 19, 2021 06:37
Prevents skipping moves in lichess analysis (engine lines)
/**
* Modifies the lichess.org analysis board engine line suggestions.
* Instead of jumping to the move that gets clicked,
* clicking anywhere on an engine line will play the first move of the line.
*/
/**
* Prevents clicking on children of the pv container.
* This works because clicking on the container itself will automatically play the first move of the pv.
*/
@370417
370417 / chrome.html
Created August 2, 2016 06:36
Chrome seach bar
<!DOCTYPE html>
<html><head><title></title><script>
const [query, bang] = window.location.search.substring(3).split('!');
const [root, search] = {
b: ['bing.com/', 'search?q='],
bi: ['bing.com/images/', 'search?q='],
g: ['google.com/', '#q='],
i: ['google.com/search?tbm=isch', '&q='],
@370417
370417 / shadowcasting.js
Created April 24, 2016 15:10
Symmetric recursive shadowcasting
/**
* Recursive shadowcasting algorithm.
* This algorithm creates a field of view centered around (x, y).
* Opaque tiles are treated as if they have beveled edges.
* Transparent tiles are visible only if their center is visible, so the
* algorithm is symmetric.
* @param cx - x coordinate of center
* @param cy - y coordinate of center
* @param transparent - function that takes (x, y) as arguments and returns the transparency of that tile
* @param reveal - callback function that reveals the tile at (x, y)
@370417
370417 / index.html
Created March 19, 2016 01:16
Exact recursive shadowcasting
<!doctype html>
<html>
<head>
<title>Recursive shadowcasting</title>
<meta charset="utf-8">
<style>
body {
margin: 0;
}
</style>