Skip to content

Instantly share code, notes, and snippets.

@haifahrul
haifahrul / Modal Angular 6.js
Last active February 7, 2019 04:47
Modal Angular 6
# Modal In Angular 6
## Component.ts
// Modal
private id: number;
public action: string;
public title: string;
public modalTitle: string;
public modalReference: NgbModalRef;
@haifahrul
haifahrul / ngx-datatable.scss
Last active February 7, 2019 07:17
ngx-datatable SCSS
@import "../../../shared/styles/colors";
@import "../../../shared/styles/constants";
/**
* Ngx-Datatable
*/
:host /deep/ .ngx-datatable.bootstrap {
margin-bottom: 50px;
box-shadow: none;
font-size: 13px;
sudo bucardo install
# ADD DATABASE
sudo bucardo add db kitaon_master dbname=kitaon host=localhost
sudo bucardo add db kitaon_slave dbname=kitaon_replica host=localhost
# ADD TABLES
sudo bucardo add all tables db=kitaon_master -T history --herd=master --verbose
sudo bucardo add all tables db=kitaon_master -t history --herd=slave --verbose
@haifahrul
haifahrul / Yii2 Grid Jeasyui - View
Created August 23, 2019 03:40
Yii2 Grid Jeasyui - View
<table id="dg" class="" toolbar="#dg-toolbar">
<thead data-options="frozen:true">
<th field="ktp" sortable="true" fixed="true" width="120">KTP</th>
<th field="people_name" sortable="true" fixed="true" width="180">Name</th>
<th field="people_gender" sortable="true" fixed="true" width="80" align="center">Gender</th>
</thead>
<thead>
<tr>
<th field="ktp" sortable="true" fixed="true" width="120">KTP</th>
<th field="people_name" sortable="true" fixed="true" width="180">Name</th>
@haifahrul
haifahrul / Yii2 Grid Jeasyui - Controller
Created August 23, 2019 03:40
Yii2 Grid Jeasyui - Controller
public function actionGetData()
{
$request = Yii::$app->request;
Yii::$app->getResponse()->format = 'json';
$query = (new \yii\db\Query())
->select('m_unit.*, m_people.*')
->from("m_people")
->leftJoin('m_unit', 'm_unit.id = unit_id');
// searching
if (($q = $request->post('q'))) {
@haifahrul
haifahrul / List of Library Useful for Golang.md
Last active November 15, 2019 04:03
List of Library Useful for Golang

List of Library Useful for Golang

  • protoc-go-inject-tag - This script injects custom tags to generated protobuf files, useful for things like validation struct tags.
  • go-proto-validators - Generate message validators from .proto annotations.
  • gogo/protobuf - Protocol Buffers for Go with Gadgets
  • protoc-gen-go/retag - A plugin for protoc-gen-go to reset struct tags.
  • protoc-gen-gotag - PGGT is a protoc plugin used to add/replace struct tags on generated protobuf messages

Implemented standard rule guide of Cross Programming Language. The proto will be using to anothers language such as NodeJS, Python, etc. So we don't recommended the library which is modifed the standard file *.proto,

@haifahrul
haifahrul / code.md
Created January 8, 2020 17:16 — forked from gopalindians/code.md
Jetbrains IntelliJ IDEA 2019.2.4 Activation code

Please make fork of this, as this can be removed by Github.com sooner or later.

CATF44LT7C-eyJsaWNlbnNlSWQiOiJDQVRGNDRMVDdDIiwibGljZW5zZWVOYW1lIjoiVmxhZGlzbGF2IEtvdmFsZW5rbyIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IklJIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiQUMiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJEUE4iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJQUyIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiRE0iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJDTCIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJTMCIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJDIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiUkQiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJQQyIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJNIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiV1MiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJEQiIsI

@haifahrul
haifahrul / GO - Config file for Air in TOML format
Last active February 3, 2020 09:08
Live reload for Go apps
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format
# Working directory
# . or absolute path, please note that the directories following must be under root.
root = "."
tmp_dir = "tmp"
[build]
# Just plain old shell command. You could use `make` as well.
cmd = "make start -o ./tmp/main ."
@haifahrul
haifahrul / GO - Air Makefile
Created February 3, 2020 09:10
Makefile for serve Air live reload for Go Apps
start:
echo 'YOUR_PASS_SUDO' | sudo -kS kill -9 `lsof -t -i:"$(SERVICES_GRPC_PORT)"` | godotenv go run main.go
serve:
air -c .air.conf
@haifahrul
haifahrul / area-example-response.json
Last active February 19, 2020 09:36
Area Example Response
[
{
"_id" : "5e4b8bcf4a5980dc45b995c1",
"name" : "Jakarta",
"regional" : [
{
"village" : "GAMBIR",
"district" : "GAMBIR",
"city" : "JAKARTA PUSAT",
"province" : "DKI JAKARTA",