Skip to content

Instantly share code, notes, and snippets.

View JasonSpine's full-sized avatar
🕹️
GameDev

Marek Adamczyk JasonSpine

🕹️
GameDev
View GitHub Profile
@t0chas
t0chas / CustomEditorBase.cs
Last active September 2, 2024 06:54
Default Custom Inspector-Editor for Unity3D with ReorderableLists for arrays handling
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System.Collections.Generic;
using UnityEditor.AnimatedValues;
[CustomEditor(typeof(UnityEngine.Object), true, isFallback = true)]
[CanEditMultipleObjects]
public class CustomEditorBase : Editor
{
@michaelbartnett
michaelbartnett / UnityApiUx.cs
Created February 5, 2016 23:40
particle system modules are weird
ParticleSystem ps = GetComponent<ParticleSystem>();
ps.enableEmission = false;
// warning CS0618: `UnityEngine.ParticleSystem.enableEmission' is obsolete: `enableEmission property is deprecated. Use emission.enable instead.'
ps.emission.enable = false;
// error CS1061: Type `UnityEngine.ParticleSystem.EmissionModule' does not contain a definition for `enable' and no extension method `enable' of type `UnityEngine.ParticleSystem.EmissionModule' could be found (are you missing a using directive or an assembly reference?)
ps.emission.enabled = false;
// error CS1612: Cannot modify a value type return value of `UnityEngine.ParticleSystem.emission'. Consider storing the value in a temporary variable
@afternoon
afternoon / url_safe_uuid.py
Last active April 29, 2017 17:12
Generate URL-safe UUID/GUIDs in Python.
#!/usr/bin/python
# Generate URL-safe UUID/GUIDs in Python, e.g.
#
# ob9G9Ju_Re6SRgxacdUzhw
# k0CWKgThQq-9b2ZcmpVXXA
#
# base64 has an urlsafe encoding
from base64 import urlsafe_b64encode
@philippbosch
philippbosch / raw_post_data_file_field.py
Created August 9, 2011 10:41
Saving raw POST data to a file field in Django
from django.core.files.base import ContentFile
uploaded_file = ContentFile(request.raw_post_data)
uploaded_file.name = "filename.txt"
my_object.file = uploaded_file
my_object.save()