Skip to content

Instantly share code, notes, and snippets.

* Customer's business information as it will appear on generated estimates:
* Company Name
* Company Email
* Company Phone
* Company Address
* Company Logo (image)
* Email address to which a CC of all estimates will be sent
* Standard Materials List
* Description
* Unit of Measure
private static BuildPlayerOptions CreateBuildPlayerOptions(string apkPath)
{
List<string> scenes = new List<string>(EditorBuildSettings.scenes
.Where(scene => scene.enabled)
.Select(scene => scene.path));
var buildPlayerOptions = new BuildPlayerOptions
{
scenes = scenes.ToArray(),
locationPathName = apkPath,
@Claytonious
Claytonious / WorldPositionUI
Last active February 15, 2016 03:07
A script to overlay 2D uGUI elements on top of 3D objects in world space
public class WorldPositionUI : MonoBehaviour
{
public GameObject worldObject;
private RectTransform rectXform;
private Graphic[] graphics;
private static float guiScale = 1.0f;
private static bool isScaleInitialized;
public void Start()
{
@Claytonious
Claytonious / gist:6555587
Created September 13, 2013 20:21
Network Messages
public class ImpactMessage : NetworkMessage
{
public Vector3 impactPosition;
public ImpactSnapshot.ImpactType impactType;
public ImpactSnapshot.AnnouncementType announcementType;
public int weaponId, munitionId;
public int simulationObjectId;
public override NetworkMessageType MessageType
{
@Claytonious
Claytonious / gist:6454444
Created September 5, 2013 18:50
Deployed Exceptions Test
try
{
Debug.Log("Foo1");
throw new System.ApplicationException("Foo");
Debug.Log("Foo2");
}
catch(System.Exception ex)
{
Debug.LogError ("Caught " + ex);
}
@Claytonious
Claytonious / gist:3989757
Created October 31, 2012 20:46
A simpler approach
// An example method that adds context without terminally handling an exception...
public static void DeleteUser(User user)
{
if (user == null)
{
throw new ArgumentNullException("user");
}
try
{
catch(SqlException sqlEx)
{
SqlException realException = sqlEx.InnerException as SqlException;
if (realException != null)
{
// Handle stored proc InnerExceptions, etc. on realException
}
else
{
// Handle stored proc InnerExceptions, etc. on sqlEx
@Claytonious
Claytonious / gist:3989596
Created October 31, 2012 20:26
Sam Neff's Passive Exception Handling
// An example method that uses the ExceptionUtil framework...
public static void DeleteUser(User user)
{
if (user == null)
{
throw new ArgumentNullException("user");
}
try
{
public static class WebSafeBase64
{
public static string ToWebSafeBase64String(byte[] input)
{
StringBuilder result = new StringBuilder(Convert.ToBase64String(input).TrimEnd('='));
result.Replace('+', '-');
result.Replace('/', '_');
return result.ToString();
}
public static byte[] FromWebSafeBase64String(string base64ForUrlInput)
public class HomeController : Controller
{
private static byte[] appSecretBytes;
private static ILog log = ApplicationContainer.Instance.ResolveConcrete<LogManager>().GetLog(typeof(HomeController));
static HomeController()
{
appSecretBytes = ASCIIEncoding.ASCII.GetBytes("YOUR FACEBOOK APP SECRET");
}