Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@empika
empika / SceneViewEditorBoilerplate.cs
Last active July 17, 2021 02:01
SceneViewEditorBoilerplate
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneViewEditorBoilerplate : ScriptableObject
{
public const string SVE_IS_ENABLED = "SVE_IS_ENABLED";
@empika
empika / AddressablesLoadAllAssets.cs
Created June 25, 2020 15:04
Addressables LoadAllAssets
public IEnumerator LoadAllAssets<T>(OnLoadAssetsCallback<T[]> callback) where T : Object
{
List<IResourceLocation> locations = getLocationsForType<T>();
AsyncOperationHandle<IList<T>> asyncOperation = Addressables.LoadAssetsAsync<T>(locations, null);
yield return asyncOperation;
if (asyncOperation.Status == AsyncOperationStatus.Succeeded)
{
callback(asyncOperation.Result.ToArray());
}
}
public class SetFontPixelly : MonoBehaviour
{
public List<Font> Fonts = new List<Font>();
public void Start()
{
foreach (Font font in Fonts)
{
font.material.mainTexture.filterMode = FilterMode.Point;
}
using System;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
using UnityEngine.Rendering;
namespace Code.Utils
{
public class MeshUtils
@empika
empika / gist:10e703989ffecfa89a98
Last active August 29, 2015 14:16
Load an array of sprites in unity
string spriteSheet = AssetDatabase.GetAssetPath( TileMapTexture );
Sprite[] sprites = AssetDatabase.LoadAllAssetsAtPath(spriteSheet).OfType<Sprite>().ToArray();
@empika
empika / gist:b3d7c9a8b3db9aa3ee9c
Created September 16, 2014 18:18
Normal mapped transparent sprites with shadows
Shader "JM/Sprite Bumped Shadows" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
[PerRendererData] _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
}
SubShader {
@empika
empika / OnConfirmCancelEditor
Created August 30, 2014 16:24
Editor extension for OnConfirmCancel
using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEditor;
[CustomEditor (typeof(OnConfirmCancel), true)]
public class OnConfirmCancelEditor : Editor
{
//
// Fields
@empika
empika / OnConfirmCancel
Last active August 29, 2015 14:05
Add Confirm and cancel handling to a Unity UI element
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
[Serializable]
public class ConfirmCancelEntry
{

Context

Certain conferences have adapted a "Code of Conduct", all derived from the same text. e.g. http://jsconf.com/codeofconduct.html e.g. https://us.pycon.org/2013/about/code-of-conduct/

While I agree with the intent, I strongly object to the particularly wording, for the following reasons:

  • The only thing it's concerned with is harassment, setting a very negative tone. It suggests that unless warned, monitored and policed, many conference attendees will intimidate, insult, grope and stalk each other. It presumes the worst and treats exceptions as the norm. This does not match the actual experience of attendees at events.
# How to set up your local development machine to use the Apigee Heroku addon
if ENV['APIGEE_TWITTER_API_ENDPOINT']
@@twitter_api = ENV['APIGEE_TWITTER_API_ENDPOINT']
else
# Get this value from Heroku.
# Once you have enabled the addon, boot up the 'heroku console' and run the following:
# puts ENV['APIGEE_TWITTER_API_ENDPOINT']
# this will spit out your correct api endpoint
@@twitter_api = "twitter-api.appXYZABC.apigee.com"