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
#include <windows.h>
void main() {
SendMessage(0xFFFF, 0x112, 0xF170, 2);
}
@audinue
audinue / build.cmd
Created March 24, 2024 11:31
Echo server & client in C.
@echo off
tcc echo_server.c
tcc echo_client.c
var neighbors = [
[ 0, 1, 0],
[ 1, 0, 0],
[ 0, -1, 0],
[-1, 0, 0],
[ 0, 0, 1],
[ 0, 0, -1]
]
var cornerTopLeftFront = [-0.5, 0.5, 0.5]
@audinue
audinue / test.js
Created November 30, 2023 17:30
Keyed diff
let { Window } = require('./happy-dom')
let window = new Window()
let document = window.document
test(
'No change',
['A', 'B', 'C', 'D'],
['A', 'B', 'C', 'D']
)
[
{
"id": "1",
"title": "Post A",
"category": {
"id": "1",
"name": "Category A"
},
"comments": [
{
@audinue
audinue / index.coffee
Created October 8, 2023 01:12
PUG + Stylus + CoffeeScript server
port = 3000
express = require 'express'
serveStatic = require 'serve-static'
serveIndex = require 'serve-index'
router = require './router'
express()
.use router
.use serveStatic('.')
.use serveIndex('.')
@audinue
audinue / kvstore.php
Last active September 25, 2023 00:05
<?php
function kvstore ($file, $init = NULL) {
static $stores = [];
$store = @$stores[$file];
if (!$store) {
$prev = @file_get_contents($file);
if (!$prev) {
if ($init) {
$prev = json_encode((object) $init());

database

Simple flat file NoSQL database.

initialize a database

$db = database('blog.json');
package sketch;
import java.awt.Rectangle;
import java.util.HashMap;
public class Ui {
//////////////////////////////////// STATE /////////////////////////////////////
private static class State {
Alignment Formula:
itemLocation = containerLocation + containerSize * alignmentFactor - itemSize * alignmentFactor
item.x = container.x + container.width * alignment.x - item.width * alignment.x
item.y = container.y + container.height * alignment.y - item.height * alignment.y