Skip to content

Instantly share code, notes, and snippets.

View SLIB53's full-sized avatar

Akil Krishnan SLIB53

View GitHub Profile
@SLIB53
SLIB53 / LazyComponents.cs
Last active August 29, 2015 14:16
Unity Lazy Component Property
private LineRenderer _lineRendererComponent;
public LineRenderer LineRendererComponent
{
get
{
if (_lineRendererComponent == null)
{
_lineRendererComponent = GetComponent<LineRenderer>();
@SLIB53
SLIB53 / CSharpDocStructure.cs
Last active September 11, 2015 18:11
C# Document Structure Example
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using Alpha;
using Beta.Alpha;
using Beta.Beta;
namespace Example
{
@SLIB53
SLIB53 / IdiomaticExample.cs
Last active August 29, 2015 14:27
A sample C# script used to explain Idiomatic vs Non-idiomatic styled code.
#define NON_IDIOMATIC
#undef NON_IDIOMATIC //comment this line out to compile idiomatic code.
#if NON_IDIOMATIC
using System;
#else
using static System.Console;
using UnityEngine;
[ExecuteInEditMode]
public class BezierTension : MonoBehaviour
{
#region Pretend you never saw this
public Transform Initial;
public Transform Mid;
public Transform End;
using System;
using System.Diagnostics;
internal class Program
{
public const int Range = 100000000;
public const int Input = 2;
private static void Main(string[] args)
{
@SLIB53
SLIB53 / InputFun.cs
Created February 25, 2016 06:45
Generates and uses Scan All code for Unity input
using UnityEngine;
using System;
using System.Collections.Generic;
public class InputFun : MonoBehaviour
{
void Start()
{
// Log Generate Code
Debug.Log(GenerateCode("") + "\n\n" + GenerateCode("Down") + "\n\n" + GenerateCode("Up"));
#!bin/bash
# Formats bash prompt to look like this (»# is job count):
# ~ »0
# $
PS1='\n\e[1;37m\w\e[m \e[0;34m»\j\e[m\n$ '
@SLIB53
SLIB53 / data_sequence.erl
Created October 17, 2016 03:43
This is an example of something like a linear data flow machine. The demo illustrates how to clearly implement a sequence of linear steps so that each step is is similarly handled. This pattern is useful for orchestrating a high level steps, such as a sequence of calls to other services in a "serverless" application.
% This is an example of something like a linear data flow machine. The demo
% illustrates how to clearly implement a sequence of linear steps so that each
% step is is similarly handled. This pattern is useful for orchestrating a high
% level steps, such as a sequence of calls to other services in a "serverless"
% application.
-module(data_sequence).
-export([demo/0]).
using UnityEngine;
namespace SS.Aspects
{
public enum AspectStatus
{
Foreground, Background, Frozen, Off
}
@SLIB53
SLIB53 / GCCyclicalRefQuestion.java
Created March 6, 2017 04:33
Does Java garbage collect unreachable objects with cyclical references? (TL;DR: YES)
/*
Question:
------------------------------------------------------------------------
In the function FooUtil.Bang(), will Java delete objects a and b?
Answer:
------------------------------------------------------------------------
Yes. Java garbage collector sees that it is unreachable. GC is not
simply a reference counter.
src: http://stackoverflow.com/questions/1910194/how-does-java-garbage-collection-work-with-circular-references#1910203