Skip to content

Instantly share code, notes, and snippets.

--[[--
Script from some base entity I once made,
usage:
Call InitProperties() from the entity's Init method.
Call ThinkProperties() from the entity's Think method.
This solution is kinda heavy because it uses think to find changes in the variables
@maritaria
maritaria / PickItems.cs
Created March 10, 2016 22:00
Pick n items from a set of items
using System;
using System.Linq;
using System.Collections.Generic;
public class Class1
{
public static IEnumerable<Class1> SomeMethodThatReturnsAllCardsAvailable()
{
return null;
}
@maritaria
maritaria / EntityFrameworkExample.cs
Created March 3, 2016 19:57
Example of EntityFramework
using System;
/*
THIS FILE WORKS BEST WHEN READ FROM TOP TO BOTTOM
WARNING, ENTITY FRAMEWOKR IS REALLY COOL BUT IM NOT AN EXPERT.
@maritaria
maritaria / IrcTwitch.cs
Created February 4, 2016 21:26
IrcTwitch with clean code solution to the compiler check dillema. Also allows you to neatly check the feature availability in v2.0 in run time!
using System;
using System.Diagnostics;
using System.Linq;
namespace HotBot.Core
{
public class TwitchIrc
{
//Imagine this class is only available when !SOME_CONSTANT
}
@maritaria
maritaria / ErrorReporting.cs
Created February 2, 2016 21:26
Simple error reporting example code
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Xml.Serialization;
namespace HotBot.Core
{
public static class ErrorReporting
@maritaria
maritaria / cleanlog.cs
Created February 2, 2016 20:58
Better logger for unity
using System.Diagnostics;
namespace HotBot.Core
{
public static class _DeleteMe
{
[Conditional("UNITY_EDITOR")]//Make sure its the correct one
public static void Log(string format, params object[] args)
{
//Code that logs stuff