Skip to content

Instantly share code, notes, and snippets.

@911992
911992 / json_mutable_writer_test.java
Created October 10, 2020 21:20
gson MutableJsonReader example
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
sample_code_java0
File: json_mutable_writer_test.java
Created on: Oct 10, 2020 12:43:02 PM
@911992
911992 / json_mutable_reader_test.java
Created October 10, 2020 21:24
gson MutableJsonReader example
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
sample_code_java0
File: json_mutable_reader_test.java
Created on: Oct 10, 2020 12:04:38 PM
@911992
911992 / winnie_the_pooh_add.c
Created October 11, 2020 23:14
Need more brain for add
#include <stdio.h>
//https://github.com/911992
//clone: https://ideone.com/nW8NGx
#define B 1024
#define A 1024
int main(void) {
int a=A;
int b=B;
int c;
@911992
911992 / array_idx_pgsql.md
Created October 30, 2020 23:50
Array indexing Postgresql

suprisingly! index are started from 1 in pgpsql when it's about arrays!, I just realize it, while i was debuging a plpsql func

An more suprising stuff is about NULL when accessing out-of-bound index of an array, well I was expecting errors!

with arr as(
  select array[911,992]::int[] as arr
)
select arr[1] from arr /*returns 911*/
union all
@911992
911992 / pgsql_trigger_arg.md
Created October 31, 2020 01:20
PostgreSQL trigger function argument

As normal array types in pgsql are started at index 1, but suprisingly, the TG_ARGV input arg for triggers are zero indexed!

This is becasue the TG_ARGV were defined to be indexed from zero

Considering following example!

create table x(
	_id serial,
	_val int
@911992
911992 / v14.4.0-SNAPSHOT_grouped_attributes_(20201125)_r0_spec.md
Created November 26, 2020 02:28
Spec of UMLet public/grouped attrib

Related to umlet#515

Spec

First shared attribs (either public/grouped) must be defined, to do so:

  • Simply select the working diagram(also works for pallets)(not an element, e.g. a blank space in diagram)
  • Start the shared public/grouped definition using [includes]
    • Any line after [includes] will be assumed as public attribs(all elements will grab it, at the first line of each)
    • For specifying a group, do it using leading # char, like #blues
      • any line after #blues will be assigned for group blues
  • Hint: # char could be escaped using \#
@911992
911992 / v14.4.0-SNAPSHOT_grouped_attributes_(20201125)_r0_samples.md
Created November 26, 2020 02:30
Samples for UMLet public/grouped attrib
@911992
911992 / js_async_func_example.html
Created November 29, 2020 15:22
JS simulated-thread using async func(no synchronization)
<!DOCTYPE html>
<!--
https://github.com/911992
-->
<html>
<head>
<script type="text/javascript">
function rand_css_col(){
var col = Math.random()*0xffffff;
return "#"+(("000000"+(col).toString(16)).substr(-6));
@911992
911992 / js_array_deep_cpy.js
Created November 30, 2020 14:32
javascript object deep copy
function obj(arg_a,arg_b){
var res={
a: arg_a,
b: arg_b,
fn:function(){
console.log("a: "+this.a + " , b: "+this.b);
}
};
return res;
}
@911992
911992 / js_image_load.html
Created December 6, 2020 02:13
Javascript image load event
<html>
<head>
<title>Kode</title>
</head>
<body>
<div id="a">
</div>
<script>
var _img_el = document.createElement("img");