Skip to content

Instantly share code, notes, and snippets.

View anztrax's full-sized avatar
🏠
Working from home

andrew ananta anztrax

🏠
Working from home
View GitHub Profile
class FillInTheBlankQuestion {
val questionText: String = ""
val answer: String = ""
val difficulty: String = ""
}
class TrueOrFalseQuestion {
val questionText: String = ""
val answer: Boolean = false
val difficulty: String = ""
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
class RangeRegulator(
initialValue: Int,
private val minValue: Int,
private val maxValue: Int,
) : ReadWriteProperty<Any?, Int> {
var fieldValue = initialValue;
@anztrax
anztrax / EncoderDecoderUtils.tsx
Created July 2, 2024 06:01
Encoder and Decoder Utils
import isEmpty from "lodash/isEmpty";
class EncoderDecoderUtils{
constructor() {
}
encodeBase64(data: string): string{
return Buffer.from(data).toString('base64');
}
@anztrax
anztrax / input
Created November 4, 2021 10:38
flat list to tree
[
{
parentId: -1,
id: 1,
value: 200
},
{
parentId: -1,
id: 2,
value: 300
@anztrax
anztrax / README.md
Last active July 26, 2021 10:44
UN population file 2019
@anztrax
anztrax / country_population.csv
Created July 3, 2021 04:36
country population
country population
China 1415046
India 1354052
United States 326767
Indonesia 266795
Brazil 210868
Pakistan 200814
Nigeria 195875
Bangladesh 166368
Russia 143965
@anztrax
anztrax / cssNamedColors.csv
Last active March 30, 2022 07:07
cssNamedColors
Specification Keyword RGB hex value
CSS Level 1 black #000000
CSS Level 1 silver #c0c0c0
CSS Level 1 gray #808080
CSS Level 1 white #ffffff
CSS Level 1 maroon #800000
CSS Level 1 red #ff0000
CSS Level 1 purple #800080
CSS Level 1 fuchsia #ff00ff
CSS Level 1 green #008000
@anztrax
anztrax / gist:1eb43a62cc0ba9fa6209dbdc352ad45d
Last active June 17, 2021 04:22
maria DB with nextJS API
import mariadb from 'mariadb';
const pool = mariadb.createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: 'my_db',
connectionLimit: 5
});
console.log('is this called ?');
/**
* the value will be all 2 , but if you change into *let*. that will not be happend
**/
let callbacks = [];
for(var i=0;i < 2; i++){
callbacks.push(() => {
console.log(i);
});
};
package imagerenderer
import (
"github.com/ungerik/go-cairo"
"image"
_ "image/jpeg"
"net/http"
)
func _decodeBase64() image.Image{