Skip to content

Instantly share code, notes, and snippets.

View bsimser's full-sized avatar
💭
Waiting for the zombie apocalypse to start

Occular Malice bsimser

💭
Waiting for the zombie apocalypse to start
View GitHub Profile
@bsimser
bsimser / StringExtensions.cs
Created October 1, 2024 17:08
Improved readability to string.IsNullOrEmpty
public static class StringExtensions
{
public static bool HasValue(this string value)
{
return !string.IsNullOrEmpty(value);
}
}
@bsimser
bsimser / Footsteps.cs
Created December 11, 2022 15:33 — forked from joonjoonjoon/Footsteps.cs
Multi-surface footsteps audio script for Unity's Viking Village
/* ======================================================================================== */
/* FMOD Studio - Unity Integration Demo. */
/* Firelight Technologies Pty, Ltd. 2012-2016. */
/* Liam de Koster-Kjaer */
/* */
/* Use this script in conjunction with the Viking Village scene tutorial and Unity 5.4. */
/* http://www.fmod.org/training/ */
/* */
/* 1. Import Viking Village asset package */
/* 2. Import FMOD Studio Unity Integration package */
@bsimser
bsimser / Footsteps.cs
Created December 11, 2022 15:32 — forked from WickedJumper/Footsteps.cs
Multi-surface footsteps audio script for Unity's Viking Village
/* ======================================================================================== */
/* FMOD Studio - Unity Integration Demo. */
/* Firelight Technologies Pty, Ltd. 2012-2016. */
/* Liam de Koster-Kjaer */
/* */
/* Use this script in conjunction with the Viking Village scene tutorial and Unity 5.4. */
/* http://www.fmod.org/training/ */
/* */
/* 1. Import Viking Village asset package */
/* 2. Import FMOD Studio Unity Integration package */
@bsimser
bsimser / HierarchySectionHeader.cs
Last active November 15, 2021 13:43
Re-styles a gameObject name in the Unity Hierarchy window to be black with white lettering and all caps to stand out
///////////////////////////////////////////////////////////////////////////////
//
// This code is licensed under MIT license.
//
// Copyright © 2014 Bil Simser, https://weblogs.aspnet/bsimser <bsimser@shaw.ca>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@bsimser
bsimser / myfacebookapp.js
Last active August 29, 2015 14:28
The bare minimum JavaScript code needed to get a Facebook app up and running with an authorization prompt. User token is saved to a cookie for retrieval by server side code.
/*
complete facebook sdk authorization/login in 20 lines (or less)
include https://connect.facebook.net/en_US/sdk.js in your html page
*/
function onLogin(response) {
if(response.status === "not_authorized") {
// send the user somewhere as they refused to authorize your app
}
}
@bsimser
bsimser / TerrainManager.cs
Last active November 15, 2021 15:05
Simple endless terrain for Unity
///////////////////////////////////////////////////////////////////////////////
//
// This code is licensed under MIT license.
//
// Copyright © 2014 Bil Simser, https://weblogs.aspnet/bsimser <bsimser@shaw.ca>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
<?xml version="1.0"?>
<package >
<metadata>
<id>Terrarium.Sdk</id>
<version>$version$</version>
<title>Terrarium SDK</title>
<authors>Microsoft, Bil Simser</authors>
<owners>Bil Simser</owners>
<licenseUrl>https://github.com/terrariumapp/terrarium-sdk/blob/master/LICENSE.md</licenseUrl>
<projectUrl>http://terrarium.azurewebsites.net/</projectUrl>
@echo Off
set config=%1
if "%config%" == "" (
set config=Release
)
set version=1.0.0
if not "%PackageVersion%" == "" (
set version=%PackageVersion%
)
@bsimser
bsimser / program.cs
Created May 26, 2012 02:19
.NET console app SignalR client
using System;
using SignalR.Client.Hubs;
namespace FANS.Demo
{
internal class Program
{
private static void Main(string[] args)
{
try
@bsimser
bsimser / SentenceParser.cs
Created January 12, 2012 19:56
Blatently stolen from somewhere, just beautiful code that I wanted to copy and use at some point
namespace System
{
public static class SentenceParser
{
public static string TrimSentence(this string @string, int length)
{
if (TheInputsAreNotValid(length, @string)) return AnEmptyString();
if (TheLengthIsLongerThanTheInputString(length, @string)) return TheOriginalString(@string);
if (TheNextCharacterIsEmpty(@string, length)) return TheNormallyParsedString(length, @string);