Skip to content

Instantly share code, notes, and snippets.

View whitehorse0's full-sized avatar
🤓
trying to make the world better with software

eka-putra whitehorse0

🤓
trying to make the world better with software
  • @bibit.id
  • Jakarta, Indonesia
View GitHub Profile

Setup Golang Workspace (My ZSH Configuration)

Download & Install

https://go.dev/dl/go1.19.10.darwin-arm64.pkg

Update your shell profile

Go expects the path of the go workspace as the $GOPATH environment variable. So you need to set up two environments to add the following two lines to your ~/.zshrc or ~/.bashrc or ~/.profile:

@whitehorse0
whitehorse0 / helper.js
Created February 12, 2020 11:27
helper function common used
{
getNestedObject: (nestedObj, pathArr) => {
return pathArr.reduce((obj, key) => (obj && obj[key] !== 'undefined') ? obj[key] : undefined, nestedObj)
},
extendObject: (accumulator, currentValue) => {
for (var p in currentValue) {
try {
if (currentValue[p].constructor == Object) {
accumulator[p] = _helper.extendObject(accumulator[p], currentValue[p])
@whitehorse0
whitehorse0 / cheatsheet-elasticsearch.md
Created February 6, 2020 06:39 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@whitehorse0
whitehorse0 / index.js
Created December 11, 2018 08:10
Here is an example of using Mocha programmatically for the integration test/ API test
// out scenario test write here
const chalk = require('chalk')
const expect = require('chai').expect
const request = require('./../request')
describe(chalk.cyanBright.bold('#GET: request to /user'), function () {
let auth = null
let user = []
before(async function () {
@whitehorse0
whitehorse0 / artillery-config.test.yaml
Last active February 21, 2024 18:59
Artillery configuration example Load testing, and allow writing custom logic JS functions to be called at certain points during the execution of a scenario.
config:
target: "http://localhost:8000"
http:
timeout: 10 # Responses have to be sent within 10 seconds or the request will be aborted
processor: "./processor.js"
phases:
# Create 100 virtual users every second for 60 seconds
- duration: 60 # seconds
arrivalRate: 100 # virtual users
const chalk = require('chalk')
const expect = require('chai').expect
const request = require('./../request')
describe(chalk.cyanBright.bold('#GET: request to /user'), function () {
let auth = null
let user = []
before(async function () {
this.timeout(10000) // 10 second
auth = await request.login({username: 'user', password: 'password'})
@whitehorse0
whitehorse0 / request.js
Last active October 28, 2018 08:46
Event request api testing
const request = require('supertest')
const headers = {
'Content-type': 'application/json',
'x-api-version': '0.1',
'token': ''
}
const baseurl = 'http://localhost:3000/api'
module.exports = {
/**
@whitehorse0
whitehorse0 / test.js
Last active October 28, 2018 06:25
File to registry API testing Node.js
const Mocha = require('mocha')
const mocha = new Mocha() // Instantiate a Mocha instance.
var testsDir = [
'./tests/api/users/'
]
for (var i = 0; i < testsDir.length; i++) {
mocha.addFile(testsDir[i])
}