Skip to content

Instantly share code, notes, and snippets.

View audinue's full-sized avatar

Audi Nugraha audinue

  • Surabaya, Jawa Timur, Indonesia
View GitHub Profile
@audinue
audinue / Container.cs
Created August 9, 2017 07:19
An automatic dependency injection container.
using System;
using System.Collections.Generic;
using System.Linq;
public sealed class Container
{
private Dictionary<Type, Type> concreteTypes = new Dictionary<Type, Type>();
private Dictionary<Type, object> objects = new Dictionary<Type, object>();
@audinue
audinue / batch.cmd
Created August 10, 2017 03:17
Konversi video buat LG TV 42PT350R
rem konversi satu directory
for %%i in (*.mp4) do call conv "%%i"
public interface ISubscriber<T>
{
void Receive(T message);
}
internal class SubscriberList : IEnumerable<object>
{
private Dictionary<Type, List<object>> subscription = new Dictionary<Type, List<object>>();
class Orderable : IOrderable
{
private int order;
private string name;
public Orderable(int order, string name)
{
this.order = order;
this.name = name;
/*
Composable 3x3 matrix module.
Exported functions:
- createIdentity (): Matrix
- createTranslation (tx: Number, ty: Number): Matrix
- createScaling (sx: Number, sy: Number): Matrix
- createRotation (a: Number): Matrix
- toRadians (d: Number): Number
- createRotationDegrees (a: Number): Matrix
@audinue
audinue / Pools.cs
Created August 19, 2017 08:00
Eager and lazy object pools.
using System;
/// <summary>
/// Implements a pool of T.
/// </summary>
public interface IPool<T>
where T : class, new()
{
T Use();
using OpenTK;
using SkiaSharp;
using System;
class SKGameWindow : GameWindow
{
private GRContext context;
protected override void OnLoad(EventArgs e)
{
@audinue
audinue / static.cmd
Last active August 27, 2017 10:12
One liner static file web server for everyday use.
node -e "const e=require('express');e().use(e.static('.')).listen(80)"
@audinue
audinue / SimpleDb.php
Last active August 28, 2017 09:04
SimpleDb
<?php
abstract class SimpleDbQueryBuilder {
protected function tablesQuery() {
return array(
'sql' => "SELECT name FROM sqlite_master WHERE type = 'table';",
'args' => array(),
);
}
@audinue
audinue / event.js
Created August 28, 2017 09:07
[Event] Typed JavaScript event class.
/**
* @typedef {{(sender: object, eventArgs: object): void}} EventHandler
*/
/**
* Represents an event.
*/
export class Event {
/**