Skip to content

Instantly share code, notes, and snippets.

View viktorbezdek's full-sized avatar

Viktor Bezdek viktorbezdek

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This formula ensures that each logo will occupy the same area, making them appear visually identical in size.

$$[ \text{New Height} = \left( \frac{\text{Target Area}}{\text{Original Width}} \right)^{0.5} ]$$

$$[ \text{New Width} = \text{Original Width} \times \left( \frac{\text{New Height}}{\text{Original Height}} \right) ]$$

@viktorbezdek
viktorbezdek / GameOfLife.ts
Created July 14, 2023 10:00
Functional TypeScript Conway's Game of Life
// Conway's Game of Life in functional TypeScript
// Game board size
const ROWS = 10;
const COLS = 10;
// Game board represented as 2D array
type Board = boolean[][];
// Create empty board
const _ = require("lodash/fp")
const sample = Array.from({ length: 90000 }).map((_, i) => i)
var nativeStart
var nativeDuration
;(() => {
nativeStart = process.hrtime.bigint()
for (let x = 0; x <= 10000; x++) {
sample.map((n) => n * 2)
'use strict';
const MD5 = (str) => {
const currentNick = M(V(Y(X(str), 8 * str.length)));
return currentNick.toLowerCase();
};
/**
* @param {string} b
* @return {?}
*/
function M(b) {
@viktorbezdek
viktorbezdek / OrgTeams.gql
Created January 10, 2023 07:42
Github GraphQL API queries
query OrgTeams($org: String!) {
organization(login: $org) {
teams(first: 100) {
pageInfo {
endCursor
hasNextPage
}
nodes {
name
}
@viktorbezdek
viktorbezdek / slightly-functional-conways-game-of-life.js
Last active October 2, 2022 16:55
Slightly Functional Game of Life
function boardGet(arr, i, j) {
if (i < 0 || j < 0 || i >= arr.length || j >= arr[i].length) {
return 0
}
return arr[i][j]
}
function countNeighbors(board, i, j) {
return (
@viktorbezdek
viktorbezdek / imperative-conways-game-of-life.js
Last active October 2, 2022 16:54
Imperative Game of Life
function conwaysGameOfLife(board) {
var newBoard = []
for (var i = 0; i < board.length; i++) {
newBoard.push([])
for (var j = 0; j < board[i].length; j++) {
newBoard[i].push(0)
}
}
for (var i = 0; i < board.length; i++) {

Keybase proof

I hereby claim:

  • I am viktorbezdek on github.
  • I am viktorbezdek (https://keybase.io/viktorbezdek) on keybase.
  • I have a public key ASBoMyVpjR-eujZHHR-cfIQlax-j1eTdmqA8Jq_BuKYr-Qo

To claim this, I am signing this object:

[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(!