Reddit user /u/GavrielBA is using three rhombuses to store a hexagon-shaped map
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
// SFC32 random number generator, public domain code adapted | |
// from https://github.com/bryc/code/blob/master/jshash/PRNGs.md | |
function PRNG(seed: number): { | |
nextInt(): number; | |
nextFloat(): number; | |
getState(): number[]; | |
setState(state: number[]): void | |
} { | |
let a = 0, b = seed, c = 0, d = 1; | |
function sfc32() { |
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
#!/bin/bash | |
# As of 2017 Feb, Instagram allows multiple photos to be posted side by side. | |
# @idealisms posted some panoramas split up into separate photos. | |
# I wrote this script to generate those square photos from a panorama. | |
if [ -z "$1" ]; then | |
echo "Usage: $0 filename.jpg" | |
exit | |
fi |
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
/** Canvas component | |
A generic canvas component that calls a draw function to draw the | |
contents, and automatically calls it again when anything the draw | |
function depends on changes. Blog entry: | |
http://simblob.blogspot.com/2018/03/using-vue-with-canvas.html | |
Example: | |
<a-canvas width="500" height="200" |
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 imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); | |
const pixels = imageData.data; | |
for (let i = 3, n = canvas.width * canvas.height * 4; i < n; i += 4) { | |
pixels[i] = pixels[i] < 127? 0 : 255 | |
} | |
ctx.putImageData(imageData, 0, 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
;;; my-diary.el --- | |
;;; Commentary: | |
;; My daily diary, inspired by org-journal, but customized for my needs. | |
;; | |
;; My keybindings: H-j to open the diary file (global binding), then | |
;; H-j to add an entry (local binding). C-c C-b, C-c C-f to move days | |
;; (like org-journal). H-i to search previous headings for completion, | |
;; so that I can reuse headings and then analyze them. |
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
using System; | |
using System.Numerics; | |
static bool InDistance1(Vector2 pos1, Vector2 pos2, float maxDistance) { | |
var distance = Math.Sqrt(Math.Pow(Math.Abs(pos2.X - pos1.X), 2) + Math.Pow(Math.Abs(pos2.Y - pos1.Y), 2)); | |
return distance <= maxDistance; | |
} | |
static bool InDistance2(Vector2 pos1, Vector2 pos2, float maxDistance) { | |
var distanceSquared = (pos2.X - pos1.X) * (pos2.X - pos1.X) + (pos2.Y - pos1.Y) * (pos2.Y - pos1.Y); |
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
license: gpl-3.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
<!DOCTYPE html> | |
<html> | |
<svg width="80%" height="80%" viewBox="-100 -100 200 200"> | |
<!-- Need this definition to make a drop shadow - based on examples from many articles, including svg spec --> | |
<defs> | |
<filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%"> | |
<feGaussianBlur in="SourceAlpha" stdDeviation="2"/> | |
<feOffset dx="5" dy="5" result="offsetblur"/> | |
<feFlood flood-color="#000000"/> |
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
// Draw simple trees | |
// Author: amitp@cs.stanford.edu | |
// License: MIT | |
// TODO: read http://procworld.blogspot.com/2011/04/tree-bits.html | |
// TODO: read http://procworld.blogspot.com/2011/05/mango-sequoia-baobab.html | |
package { | |
import flash.display.*; | |
import flash.geom.Point; |
NewerOlder