Skip to content

Instantly share code, notes, and snippets.

Trevor Berninger Delamare2112

View GitHub Profile
@Delamare2112
Delamare2112 / .gitattributes
Created Feb 13, 2018
Unity LFS attributes
View .gitattributes
## 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
View itoawb.cpp
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)
View Git Going.md

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/

View build.bat
:: 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
View LinkedList.asm
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 Mar 24, 2016
A great way to both generate and recieve random data
View EntropyManager.java
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 Sep 11, 2017
A unity script that procedurally generates a map given rooms and pickups
View MapGenerator.cs
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 Mar 18, 2016
Like SendMessage but with as many aparams as you want!
View BetterSendMessages.cs
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)
{
View PackedDynamicArray.cpp
/*
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>
View Howl()
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.
You can’t perform that action at this time.