Skip to content

Instantly share code, notes, and snippets.

View Delamare2112's full-sized avatar

Trevor Berninger Delamare2112

View GitHub Profile
@Delamare2112
Delamare2112 / .gitattributes
Created February 13, 2018 17:57
Unity LFS attributes
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
std::string itoawb(size_t val, size_t base)
{
if(val == 0)
return "0";
size_t buffSize = (size_t)(log2(val) + 1);
std::string ret(buffSize, 0);
buffSize *= 1.25;
buffSize++;
size_t i = buffSize-1;
for(;val && i; --i, val /= base)

Git Going

Step 1: git installation

Download git from here: https://git-scm.com/

Feel free to change install settings as some are personal preferences. Like for example choosing whether or not you want git to add buttons to your Windows-right-click-a-file menu. Personally I always uncheck adding Git GUI to my menus because I never use it.

Also download https://git-lfs.github.com/

:: build.bat
@echo off
FOR %%i IN (*.sln*) DO (
set file=%%i
)
set file=%file:~0,-4%
del %file%\Debug /Q
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe %file%\%file%.vcxproj
INCLUDE Irvine32.inc
newLine EQU 0Dh, 10, 0
write MACRO string
mov edx, OFFSET string
call WriteString
ENDM
movmem MACRO dest, source
@Delamare2112
Delamare2112 / EntropyManager.java
Created March 24, 2016 07:09
A great way to both generate and recieve random data
package com.terrasect.entropygenerator;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Calendar;
@Delamare2112
Delamare2112 / MapGenerator.cs
Last active September 11, 2017 08:07
A unity script that procedurally generates a map given rooms and pickups
using UnityEngine;
using System.Collections;
using System.Linq;
public class MapGenerator : MonoBehaviour
{
public Room[] roomPrefabs;
public Item[] itemPrefabs;
public int rows,columns;
public float roomWidth, roomHeight, itemDropChance;
@Delamare2112
Delamare2112 / BetterSendMessages.cs
Created March 18, 2016 00:49
Like SendMessage but with as many aparams as you want!
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
public static class Extensions
{
public static void BetterSendMessage(this Component obj, string function, params object[] args)
{
/*
A good collection for when you need indices not to change when modifying the collection.
Dynamically allocates when out of space.
Values keep their indices after a remove.
Values that are removed are quickly replaced before moved to the back of the collection.
Trevor Berninger - Oct 18, 2015
*/
#include <iostream>
#include <vector>
I saw the best minds of our generation destroyed by the week types,
implicitly casting themselves through type after type looking for a final allocation,
lazy and quick developers forgetting the woes of memory management,
let the garbage collector worry about that.
Whose objects need not be truly object oriented,
Who be wise in indentation but never ever bitwise,
Whose strings are important and large,
Who leaves lines of logic open to interpretation.