Skip to content

Instantly share code, notes, and snippets.

View Xrayez's full-sized avatar
🔱
Ukraine is winning

Andrii Doroshenko Xrayez

🔱
Ukraine is winning
View GitHub Profile
@Xrayez
Xrayez / StateRecorder.gd
Created December 10, 2017 11:03
State recorder using AnimationPlayer in Godot
# This is a prototype of the state recorder that can be used in a replay system
extends AnimationPlayer
var nodes = []
var animations = {}
var properties = ["global_position", "global_rotation"]
func _init():
set_name("state_recorder")
@Xrayez
Xrayez / hide_unless_hover.css
Created January 23, 2018 11:43
CSS style for hiding graphical content
/* Hides most graphical content by default unless you need to see it.
/* NOTE: can be used in Stylish as a theme */
/* Hide some of the annoying background images (but not all...) */
table div {
background-image: none !important;
}
/* Hide any element that has `src` attribute (images, youtube videos, thumbnails, etc) */
/* May hide control elements like buttons, but they will be visible by an outline */
@Xrayez
Xrayez / mingw-mxe.sh
Last active April 16, 2023 12:13
Build the latest MinGW toolchain
#!/bin/bash
#
# Build the latest MinGW toolchain
#
# WARNING: this is just a list of steps and not an actual script, some steps could work though...
#
# Download MXE
git clone https://github.com/mxe/mxe.git && cd mxe
@Xrayez
Xrayez / prepare-commit-msg
Last active April 16, 2023 12:09
An example git hook which shows how to append an arbitrary bit of information to a commit
#!/bin/sh
#
# An example git hook which shows how to append an arbitrary bit of information to a commit.
# The following appends some version number to a commit message.
#
VERSION=$(command --version) # `command` is any executable
BUILD="Xrayez" # Some arbitrary name
# Ensure that version contains some build name
@Xrayez
Xrayez / colors.lua
Last active April 16, 2023 12:01
Lua colors, 0.25 step
-- Uses 0.25 step between shades of color, a total of 23 colors.
-- Assumes `color` to be already implemented as a callable table or a function.
local colors = {
color(1.0, 0.0, 0.0),
color(1.0, 0.25, 0.0),
color(1.0, 0.5, 0.0),
color(1.0, 0.75, 0.0),
color(0.75, 1.0, 0.0),
color(0.5, 1.0, 0.0),
color(0.25, 1.0, 0.0),
@Xrayez
Xrayez / get-pr.sh
Last active April 21, 2019 18:18
A simple bash function to fetch and checkout pull request using Git
get-pr() {
git fetch origin pull/"$1"/head:pr-"$1";
git checkout pr-"$1";
}
@Xrayez
Xrayez / github-branch-rename.sh
Last active April 29, 2020 23:12 — forked from ccopsey/gist:9866a0bcb0b39ade04fe
Rename master branch on GitHub
git branch -m master newname
git push origin newname
# Change "Default Branch" in settings/options in GitHub
git push --delete origin master
@Xrayez
Xrayez / listdir_recurse.ps1
Last active June 6, 2020 09:23
Powershell commands
# Get a list of absolute directory paths starting from current directory recursively.
Get-ChildItem -Recurse -Directory | Select Fullname
@Xrayez
Xrayez / bresenham_circle.lua
Last active April 16, 2023 13:41
Basic Bresenham circle implementation in Lua
# Ported from https://www.daniweb.com/programming/software-development/threads/321181/python-bresenham-circle-arc-algorithm
-- Bresenham circle
function circle(radius)
local pixels = {}
local switch = 3 - (2 * radius)
local x = 0
local y = radius
while x <= y do
table.insert(pixels, {x, -y})
@Xrayez
Xrayez / BreadthFirstIterator.java
Created February 8, 2022 13:35 — forked from deyindra/BreadthFirstIterator
BFS and DFS Iterator for Graph
import java.util.*;
public class BreadthFirstIterator<T> implements Iterator<T> {
private Set<T> visited = new HashSet<>();
private Queue<T> queue = new LinkedList<>();
private Graph<T> graph;
public BreadthFirstIterator(Graph<T> g, T startingVertex) {
if(g.isVertexExist(startingVertex)) {
this.graph = g;