Skip to content

Instantly share code, notes, and snippets.

View figgleforth's full-sized avatar

figgleforth

  • New Hoffenscheim
View GitHub Profile
# Based on https://gamedev.stackexchange.com/questions/182534/comparing-analog-stick-movements-to-predefined-flick-shapes
extends Node2D
signal gesture_began(recognizer, gesture)
signal gesture_ended(recognizer, gesture)
signal gesture_recognized(recognizer, gesture)
export(bool) var draw_gizmos = true
export(int) var gizmo_line_resolution = 100
export(float) var gizmo_analog_diagram_line_width = 2.0
@figgleforth
figgleforth / EnumMaskPropertyDrawer.cs
Created November 18, 2018 13:59
Helpful script for displaying uints in the Unity inspector
/*
Written by: Lucas Antunes (aka ItsaMeTuni), [email protected]
In: 2/15/2018
The only thing that you cannot do with this script is sell it by itself without substantially modifying it.
*/
using System;
using UnityEngine;
#if UNITY_EDITOR
@figgleforth
figgleforth / keypath.rb
Last active September 3, 2016 20:47
Ruby class extensions for accessing object values by keypath
module Keypathable
## Operators
####
# Non mutating operator
def >(keypath)
if self.is_a?(Array) || self.is_a?(ActiveRecord::Associations::CollectionProxy)
return self.values_for_keypath(keypath)
else
@figgleforth
figgleforth / UIImage+pixelData.swift
Last active January 17, 2023 19:26
Extract RGBA pixel data from an UIImage in Swift
//
// UIImage+pixelData.swift
//
// Created by Bojan Percevic on 5/25/15.
// Copyright (c) 2015. All rights reserved.
//
import Foundation
extension UIImage {
@figgleforth
figgleforth / NSImage+pixelData.swift
Last active July 22, 2022 15:22
Extract RGBA pixel data from an NSImage in Swift
//
// NSImage+pixelData.swift
//
// Created by Figgleforth on 5/21/15.
// Copyright (c) 2015 Bojan Percevic. All rights reserved.
//
import AppKit
extension NSImage {
@figgleforth
figgleforth / Keyboard.swift
Last active January 13, 2022 13:18
Keyboard input for use with SpriteKit or SceneKit
//
// Keyboard.swift
//
// Created by Bojan Percevic on 5/21/15.
// Copyright (c) 2015 Bojan Percevic. All rights reserved.
//
import AppKit
enum Key: CUnsignedShort {