Skip to content

Instantly share code, notes, and snippets.

#import "TestCGBitmapContextCreate_iOSTests.h"
@implementation TestCGBitmapContextCreate_iOSTests
- (void)setUp
{
[super setUp];
// @source: https://gist.github.com/darktable/2018687#file-guiscaler-cs
using System;
using System.Collections;
using UnityEngine;
/// Usage:
/// (optional) Call GUIScaler.Initialize() in Start(), Awake() or OnEnable() (only needed once)
using UnityEngine;
using System.Collections;
public class OrderTester : MonoBehaviour {
void Update() { Debug.Log("Update()"); }
void LateUpdate() { Debug.Log("LateUpdate()"); }
void FixedUpdate() { Debug.Log("FixedUpdate()"); }
void Awake() { Debug.Log("Awake()"); }
void Start() { Debug.Log("Start()"); }
void Reset() { Debug.Log("Reset()"); }
@capnslipp
capnslipp / Matrix4x4Extensions.cs
Last active August 29, 2015 13:56
Fix for Unity3D's broken Matrix4x4.isIdentity
/// @usage: Use as you would a native Matrix4x4 method;
/// e.g. `this.transform.localToWorldMatrix.IsActuallyIdentity()`
/// @usage: Lives best within `Assets/Plugins/`.
using UnityEngine;
public static class Matrix4x4Extensions
{
@capnslipp
capnslipp / gist:8552399
Created January 22, 2014 02:17
C# modifier syntax wishlist
struct Plainy
{
public:
readonly:
int foo;
int bar;
}
static class Clingy
@capnslipp
capnslipp / SerializedPropertyValueExtension.cs
Last active June 18, 2023 19:45
Genericized #Unity3D SerializedProperty value access, an extension that should be part of the API.
/// @creator: Slipp Douglas Thompson
/// @license: Public Domain per The Unlicense. See <http://unlicense.org/>.
/// @purpose: Genericized Unity3D SerializedProperty value access.
/// @why: Because this functionality should be built-into Unity.
/// @usage: Use as you would a native SerializedProperty method;
/// e.g. `Debug.Log(mySerializedProperty.Value<Color>());`
/// @intended project path: Assets/Plugins/Editor/UnityEditor Extensions/SerializedPropertyValueExtension.cs
/// @interwebsouce: https://gist.github.com/capnslipp/8516384
using System;
@capnslipp
capnslipp / HideInNormalInspectorAttribute.cs
Last active April 12, 2022 09:39
Unity HideInNormalInspector attribute
/// @creator: Slipp Douglas Thompson
/// @license: Public Domain per The Unlicense. See <http://unlicense.org/>.
/// @purpose: HideInNormalInspector attribute, to hide fields in the normal Inspector but let them show in the debug Inspector.
/// @why: Because this functionality should be built-into Unity.
/// @usage: Add `[HideInNormalInspector]` as an attribute to public fields you'd like hidden when Unity's Inspector is in “Normal” mode, but visible when in “Debug” mode.
/// @intended project path: Assets/Plugins/EditorUtils/HideInNormalInspectorAttribute.cs
/// @interwebsouce: https://gist.github.com/capnslipp/8138106
using UnityEngine;
slippyd@silverdelicious:~$ cd Desktop/
# cloning git repo from github:
slippyd@silverdelicious:~/Desktop$ git clone git@github.com:capnslipp/p001.git p001_git
Cloning into 'p001_git'...
remote: Counting objects: 3360, done.
remote: Compressing objects: 100% (870/870), done.
remote: Total 3360 (delta 2407), reused 3331 (delta 2380)
@capnslipp
capnslipp / pre-push
Created October 3, 2013 23:55
Standard project .git/hooks/pre-push This pre-push hook (which I use for many of my projects) skips pushing branches and tags that start with “wip/”, “tmp/”, or “local/”. This makes it easy to keep commits marked as work-in-progress, temporary, or local-only from leaking upstream. Requires git 1.8.2, in which pre-push hooks were introduced.
#!/bin/sh
#
# Hook script that blocks pushing of branches and tags with the form 'wip/*', and commits commits the log message starts
# with "WIP" (work in progress)..
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
@capnslipp
capnslipp / Current Block Syntax.m
Last active December 19, 2015 19:09
Brainstorming a more Obj-C-like block syntax
double (^multiplyTwoValues)(double, double) = ^(double firstValue, double secondValue) {
return firstValue * secondValue;
};
double result = multiplyTwoValues(2, 4);
// or
typedef double (^CombineTwoValuesBlock)(double firstValue, double secondValue);