Skip to content

Instantly share code, notes, and snippets.

View h0h0h0's full-sized avatar

Shaun Farrugia h0h0h0

View GitHub Profile
if (new URLSearchParams(window.location.search).get('portal')) {
// <create start portal>
// Create portal group to contain all portal elements
const startPortalGroup = new THREE.Group();
startPortalGroup.position.set(SPAWN_POINT_X, SPAWN_POINT_Y, SPAWN_POINT_Z);
startPortalGroup.rotation.x = 0.35;
startPortalGroup.rotation.y = 0;
// Create portal effect
@alican
alican / django_field_update_checker.txt
Last active September 17, 2023 08:46
check if django model fields changed after save
class DjangoModel(models.Model):
@classmethod
def from_db(cls, db, field_names, values):
instance = super().from_db(db, field_names, values)
instance._state.adding = False
instance._state.db = db
instance._old_values = dict(zip(field_names, values))
return instance
@Vaguery
Vaguery / gist:83088b27c557dfbb0617
Created June 10, 2014 12:44
Wrestling with Swift identity functions
import Cocoa
// This is a Swift Playground to explore some unexpected behavior of '==='.
//
// ICYMI, '===' is the test of _identity_ in Swift; two values a,b are
// references to the same object if a === b
//
// My concern with this is the necessity of testing eqality and identity when
// manipulating complex graphs constructed automatically by code.
//