Skip to content

Instantly share code, notes, and snippets.

View wuriyanto48's full-sized avatar

wuriyanto wuriyanto48

View GitHub Profile
@wuriyanto48
wuriyanto48 / obj_min.js
Last active April 11, 2017 10:48
Find minimum value from object in Javascript
let price = {
"vendorPrice": 150000,
"normalPrice": 229000,
"pPrice": 90000,
"specialPrice": 169000,
"promoPrice": 0
};
function minPrice(prices){
let arrPrices = [];
@wuriyanto48
wuriyanto48 / pbkdf2_crypto_nodejs.js
Last active April 24, 2017 07:10
Encrypt and Verify PBKDF2 using Crypto Node Js (Note: in this example number of Iterations are included in Salt)
'use strict';
let crypto = require('crypto');
let config = {
digestAlgorithm: 'sha1',
keyLen: 64,
saltSize: 64,
iterations: 15000
};
package main
import (
"fmt"
"sync"
)
var wg sync.WaitGroup
type Processor struct {
@wuriyanto48
wuriyanto48 / findHighestFieldInsideStruct.go
Created August 7, 2017 08:08
FInd Highest Value inside Go Struct's Field
package main
import (
"fmt"
"encoding/json"
)
type ShippingCostReadModel struct {
@wuriyanto48
wuriyanto48 / event_listener.go
Created April 3, 2018 16:05
what the heck is this..
package main
import (
"fmt"
)
type OnClickListener interface {
OnClick()
}
@wuriyanto48
wuriyanto48 / event_listener.go
Created April 3, 2018 16:05
what the heck is this..
package main
import (
"fmt"
)
type OnClickListener interface {
OnClick()
}
@wuriyanto48
wuriyanto48 / main_test.go
Created May 11, 2018 05:32 — forked from alexedwards/main_test.go
MaxOpenConns benchmark
package main
import (
"database/sql"
"testing"
"time"
_ "github.com/lib/pq"
)
@wuriyanto48
wuriyanto48 / main.go
Created September 7, 2018 03:12
Database migration in Mongo Db from JSON data
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"time"
SELECT s.id, s.sha1, f.name
FROM storage s
JOIN file f ON s.id = f.storage_id
WHERE s.count > 0
ORDER by id DESC, name ASC
OFFSET 1000 LIMIT 10
------------------------------
db.file_storage.aggregate([
@wuriyanto48
wuriyanto48 / main.go
Created September 20, 2018 03:58
Golang (interface to slice string)
package main
import (
"encoding/json"
"fmt"
"reflect"
)
var data = `[
{