This file contains hidden or 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 layout() { | |
return { | |
name: "Quadrants", | |
getFrameAssignments: (windows, screenFrame) => { | |
const columnWidth = screenFrame.width / 2; | |
const rowHeight = screenFrame.height / 2; | |
const frames = windows.map((window, index) => { | |
const frame = { | |
x: screenFrame.x + (columnWidth * (index % 2)), | |
y: screenFrame.y + (index < 2 ? 0 : rowHeight), |
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<title>Dragon Drop</title> | |
<style> | |
:root { | |
--background-color: #181824; | |
--text-color: #fff; | |
--scrollbar-thumb-color: #fff; |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"io" | |
"os" | |
"strings" | |
) | |
func main() { |
This file contains hidden or 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
func BitsN(n int64) []int64 { | |
var bits []int64 | |
bits = make([]int64, 0) | |
for { | |
if n == 0 { | |
return bits | |
} | |
bits = append(bits, n % 2) | |
n >>= 1 |
This file contains hidden or 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
class Memoize: | |
def __init__(self, func): | |
self.prevs = {} | |
self.func = func | |
def __call__(self, *args): | |
if not args in self.prevs: | |
self.prevs[args] = self.func(*args) | |
return self.prevs[args] |