Skip to content

Instantly share code, notes, and snippets.

View daverave1212's full-sized avatar

David Irimia daverave1212

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
public static class U {
// Math
public static double PercentOf(this double value, double ofWhat) {
return ofWhat * value / 100;
@daverave1212
daverave1212 / ExtensionUtils.cs
Created January 29, 2025 14:49
ExtensionUtils.cs
using System;
public static class ExtensionUtils {
public static float DistanceTo(this (float, float) pointA, (float, float) pointB) {
var (ax, ay) = pointA;
var (bx, by) = pointB;
return (float) Math.Sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}
// Online C# Editor for free
// Write, Edit and Run your C# code using C# Online Compiler
using System;
using System.Linq;
public class HPoint {
public float X;
public float Y;
@daverave1212
daverave1212 / EloSystem.cs
Last active January 13, 2025 19:38
A generic Match making system made in C# for elo calculations. Simply take this file and use it as in the example.
/*
Use like:
float[] eloChanges = EloSystem.CalculateEloChanges(playerElos: new float[] { 14000, 4500, 11000, 17444, 6969, 21000 }, winnerIndex: 1, eloStakes: 100, isDebug: true);
float[][] teamsEloChanges1 = EloSystem.CalculateTeamsEloChanges(teamsWithPlayerElos: new[] { team1, team2, team3 }, winnerIndex: 1, eloStakes: 100, isDebug: true);
float[][] teamsEloChanges2 = EloSystem.CalculateTeamsEloChanges(teamsWithPlayerElos: new float[][] {
new float[] { 14000, 4500 },
new float[] { 11000, 17444 },
new float[] { 6969, 21000 },
}, winnerIndex: 1, eloStakes: 100, isDebug: true);
// Run with `groovy caesars-casino.groovy`
// (c) 2011 Playtika
// This code is licensed under MIT license (see LICENSE.txt)
import java.util.Collections;
class CaesarsCasino {
static void main(String[] args) {
def symbolsOnLine = "\$@#7?"
def machine = new Machine(symbolsOnLine)
@daverave1212
daverave1212 / SGBD Proiect.md
Last active June 2, 2020 14:27
SGBD Proiect
<title>SGBD Proiect</title>
@daverave1212
daverave1212 / PL-SQL.md
Last active January 15, 2021 17:17
PL-SQL
<title>PL-SQL</title>
<title>Crypto Examen</title>
@daverave1212
daverave1212 / Calcul Numeric Sheet.md
Last active January 21, 2021 14:42
Matlab Understandings

Cursul 1

Metoda bisectiei

eroarea absoluta = |x - xk| <= b-a / 2^k+1^> functia f definita pe [a,b], epsilon

loop log2( b-a /| supra epsilon) +1 times
	x = a + (b - a)/2
	if f(x) == 0

return last x

@daverave1212
daverave1212 / PlaneTriangleUtils.cs
Created April 15, 2020 22:02
Remove triangles and squares from a 3D plane object.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*
* How to use:
* .DestroySquareAtPosition( Vector3 ) //
* .DestroyTriangleAtPosition( Vector3 ) // Returns true if a triangle was found;
*
*/