Skip to content

Instantly share code, notes, and snippets.

View victorbstan's full-sized avatar

Victor Stan victorbstan

  • Toronto & Remote
View GitHub Profile
@StagPoint
StagPoint / DoPlanesIntersectAtSinglePoint.cs
Created September 25, 2018 17:57
Find intersection point of three planes in C# for Unity
private bool planesIntersectAtSinglePoint( Plane p0, Plane p1, Plane p2, out Vector3 intersectionPoint )
{
const float EPSILON = 1e-4f;
var det = Vector3.Dot( Vector3.Cross( p0.normal, p1.normal ), p2.normal );
if( det < EPSILON )
{
intersectionPoint = Vector3.zero;
return false;
}
@coderespawn
coderespawn / dungeon-architect-ue4-release-notes.md
Last active September 13, 2024 06:55
Dungeon Architect Release Notes [UE4]

CHANGELOG: Dungeon Architect

Version 2.33.0 Release Notes [13-Sep-2024]

  • New: Dungeon Canvas Framework has been rewritten to be more powerful and flexible. It is faster, takes up less memory, support for different camera types, minimap materials that can be applied to the world, multiple widgets can share the same dungeon canvas resources with different themes and a lot more. This also paves the way for future PCG integration
  • New: Updated documentation on Dungeon Canvas
  • New: Automated Dungeon Build System to automatically build your dungeons at runtime (also works on multiplayer). Control this from the Dungeon actor's detail panel. This avoids a lot of boilerplate blueprint code
  • New: SGF supports Entrance / Exit connection constraints
  • New: Grid Dungeon Platform Volumes optionally clamp the Z value of the generated dungeons. These are
@blainerothrock
blainerothrock / gen.swift
Last active August 12, 2024 15:26
A Very Simple Genetic Algorithm Written in Swift 3
#!/usr/bin/env xcrun swift -O
/*
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3
-------------------- https://gist.github.com/cfdrake/973505 ---------------------
gen.swift implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many
@YclepticStudios
YclepticStudios / ConvexHull.cs
Created October 23, 2016 20:55
Convex hulling algorithm for Unity; converts a point cloud into triangle indices for meshing.
/**
* ============================================================================
* MIT License
*
* Copyright (c) 2016 Eric Phillips
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,

What's the difference between cascade="remove" and orphanRemoval=true in Doctrine 2

TLDR: The cascade={"remove"} is like a "software" onDelete="CASCADE", and will remove objects from the database only when an explicit call to $em->remove() occurs. Thus, it could result in more than one object being deleted. orphanRemoval can remove objects from the database even if there was no explicit call to ->remove().

I answered this question a few times to different people so I will try to sum things up in this Gist.

Let's take two entities A and B as an example. I will use a OneToOne relationship in this example but it works exactly the same with OneToMany relationships.

class A
@ericelliott
ericelliott / essential-javascript-links.md
Last active September 9, 2024 15:49
Essential JavaScript Links
@omgwtfgames
omgwtfgames / NoiseTexture.cs
Last active March 17, 2021 00:18 — forked from KdotJPG/OpenSimplex2S.java
Visually axis-decorrelated coherent noise function based on the Simplectic honeycomb - C# port
/*
* OpenSimplex (Simplectic) Noise Test for Unity (C#)
* This file is in the Public Domain.
*
* This file is intended to test the functionality of OpenSimplexNoise.cs
* Attach this script to a GameObject with mesh (eg a Quad prefab).
* Texture is updated every frame to assist profiling for performance.
* Using a RenderTexture should perform better, however using a Texture2D
* as an example makes this compatible with the free version of Unity.
*
anonymous
anonymous / simblebox.js
Created August 13, 2014 19:27
Custom simple lightbox
(function($) {
// SIMPLE BOX
// make your own lightbox cuz they all suck
var imgSrc
, $simpleBox;
window.fitImg = function() {
var $img = $("#simple-box img");
@Silvenga
Silvenga / ghost.conf
Last active August 29, 2015 13:57
Ghost Upstart Script
start on filesystem and started networking
stop on shutdown
author "Mark Lopez"
description "Ghost Upstart Job"
version "0.2"
respawn
respawn limit 5 30
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->