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

Rumus Laba Bersih untuk Perusahaan Dagang

Total Pembelian = Pembelian + Biaya Angkut Pembelian - Retur Pembelian - Potongan Pembelian

HPP (Harga Pokok Penjualan) = Persediaan Awal - Total Pembelian - Persediaan Akhir

Total Penjualan = Penjualan - Retur Penjualan - Potongan Penjualan

Laba Kotor = Total Penjualan - HPP
@audinue
audinue / start.js
Created April 29, 2017 00:35
Start a background process in Windows with Node JS
var childProcess = require('child_process')
childProcess.spawn('start', ['/b', 'ping', 'http://google.com'], {
shell: true,
stdio: 'ignore'
})
console.log('Process started')
@audinue
audinue / Util.cs
Last active May 14, 2017 06:55
C# Debounce
using System;
using System.Threading;
using System.Threading.Tasks;
/**
* <summary>C# implementation of JavaScript's setTimeout.</summary>
*/
public static CancellationTokenSource setTimeout(Action callback, int delay = 100)
{
CancellationTokenSource source = new CancellationTokenSource();
@audinue
audinue / plugin-system.md
Last active May 15, 2017 04:01
C# Plugin System with Visual Studio

C# Plugin System with Visual Studio

Say, your application name is App. Within a Solution do:

1. Create a new Class Library project named Plugin

  1. Change Assembly name to App.Plugin
  2. Change Default namespace to App
  3. Create an new abstract class named Plugin:
var assembly = AssemblyDefinition.ReadAssembly("Cecil.exe");
var module = assembly.MainModule;
var type = module.GetType("Cecil.Program");
foreach (var field in type.Fields.Where(f => f.IsPublic && f.CustomAttributes.Any(a => a.AttributeType.Name == "ToPropertyAttribute")).ToArray())
{
var newField = new FieldDefinition("_" + field.Name, FieldAttributes.Private, field.FieldType);
newField.InitialValue = field.InitialValue;
var newProperty = new PropertyDefinition(field.Name + "X", PropertyAttributes.None, field.FieldType);
newProperty.HasThis = true;
@audinue
audinue / Util.Capture.cs
Created June 7, 2017 18:53
Captures console output.
using System;
using System.IO;
partial class Util {
/// <summary>
/// Captures console output.
/// </summary>
public static string Capture(Action action) {
var before = Console.Out;
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
a += 1f;
var g = e.Graphics;
var gp = new GraphicsPath();
gp.AddRectangle(new RectangleF(0, 0, 100, 100));
var m = new Matrix();
m.Translate(100, 100);
@audinue
audinue / README.md
Last active July 23, 2017 05:18
Javascript Simple Entity Component System Engine

Javascript Simple Entity Component System Engine

Entities represented by plain objects.

const player = {}

Components represented by entity properties.

@audinue
audinue / Hub.cs
Last active July 24, 2017 00:27
C# Hub
using System;
using System.Collections.Generic;
public abstract class Hub<T> : IDisposable where T : Hub<T>
{
private Dictionary<Type, List<MulticastDelegate>> subscribers = new Dictionary<Type, List<MulticastDelegate>>();
private bool disposed;
private void CheckDisposed()
{
@audinue
audinue / Publisher.cs
Last active July 28, 2017 02:47
Powerful message subscription system.
/// <summary>
/// Represents an abstract generic message.
/// </summary>
public abstract class Message<T> {
private readonly T content;
public Message(T content) {
this.content = content;
}