Skip to content

Instantly share code, notes, and snippets.

View kroltan's full-sized avatar

Leonardo Giovanni Scur kroltan

View GitHub Profile
@kroltan
kroltan / shitty_xml.rs
Created September 7, 2021 16:44
World's second-worst Rust XML writing library
use std::{
borrow::BorrowMut,
io::{Error, ErrorKind, Write},
};
#[derive(Debug)]
enum State {
Open,
Attribute,
Children,
@kroltan
kroltan / main.rs
Created November 3, 2020 20:06
Pong game in Bevy
#![feature(clamp)]
#![feature(iterator_fold_self)]
use bevy::prelude::*;
use rand::Rng;
#[derive(Default)]
struct PlayerUser;
#[derive(Default)]
This file has been truncated, but you can view the full file.
{"type":"MultiPolygon","coordinates":[[[[47.5557972,10.4544285],[47.5551352,10.4556876],[47.5550719,10.4558078],[47.5535543,10.458709],[47.553313,10.4591702],[47.5526228,10.4604899],[47.5525534,10.4610335],[47.5523833,10.4623663],[47.5522484,10.4634235],[47.552125,10.4643889],[47.5519806,10.4655194],[47.5518273,10.4667194],[47.5517937,10.4669833],[47.5517804,10.4670872],[47.551767,10.4671917],[47.5514615,10.4695874],[47.5514551,10.4696375],[47.55143,10.4698342],[47.551418,10.4699274],[47.5514062,10.4700189],[47.5511641,10.4719124],[47.5511101,10.4723343],[47.5506811,10.4729946],[47.5506369,10.4730629],[47.5501816,10.4737687],[47.5489971,10.4756048],[47.5488651,10.4758093],[47.5488044,10.4759033],[47.546828,10.4789622],[47.5451196,10.4816072],[47.5436414,10.4838952],[47.5433404,10.484361],[47.5420541,10.4863516],[47.540403,10.4889121],[47.5399989,10.4916708],[47.5398128,10.49293],[47.5396708,10.4938907],[47.5395525,10.4946915],[47.5392171,10.4969852],[47.5391034,10.4977627],[47.538952,10.4987868],[47.5389518,1
@kroltan
kroltan / CameraCollision.cs
Created October 14, 2017 14:00
nice camera collision avoidance
using JetBrains.Annotations;
using UnityEngine;
namespace Rayleigh.Cameras {
[RequireComponent(typeof(Camera))]
public class CameraCollision : MonoBehaviour {
public LayerMask LayerMask = -1;
public float TargetDistance = 1;
public float Speed = 1;
@kroltan
kroltan / broken.rs
Last active August 20, 2017 13:10
Equivalent code works on Playground, but not on code itself
// error[E0597]: borrowed value does not live long enough
// --> src/transport.rs:189:36
// |
// 189 | .and_then(|ref d| {
// | ^^^^^ does not live long enough
// ...
// 192 | });
// | - temporary value only lives until here
// |
// note: borrowed value must be valid for the lifetime 'de as defined on the impl at 176:1...
@kroltan
kroltan / khotnet.js
Last active August 29, 2015 14:12
Userscript to ignore hot network questions on Stack Exchange sites(tested in Greasemonkey)
// ==UserScript==
// @name Stack Exchange Hot Network Questions Filter
// @namespace kroltan.stackexchange.hotfilter
// @description Allows hiding seen or uninteresting questions from the Hot Network Questions list.
// @include /^https?://.*\.stackoverflow\.com/.*/
// @include /^https?://.*\.stackexchange\.com/.*/
// @version 1
// @grant none
// ==/UserScript==
/*
@kroltan
kroltan / citrus.YAML-tmLanguage
Created July 24, 2014 00:08
Source for a partial Citrus (https://github.com/mjackson/citrus) syntax highlight for Sublime Text
# [PackageDev] target_format: plist, ext: tmLanguage
---
name: Citrus Syntax
scopeName: source.citrus
fileTypes: [citrus]
uuid: 77fff91f-c9aa-4189-9047-620c87314be2
patterns:
- name: keyword.control.grammar.citrus
match: grammar