Skip to content

Instantly share code, notes, and snippets.

View hdinjos's full-sized avatar
🤩
gagego tik!

Hendi Saputra hdinjos

🤩
gagego tik!
  • axarschool
  • Yogyakarta
View GitHub Profile
@hdinjos
hdinjos / contractor_dart.md
Created May 29, 2023 07:58
OOP with dart
void main() {
  //make instance from class, to make object
  Animal animal = Animal(name: "Ayam", age: 5);
  
  //call object method
  print(animal.getFullStory());
  
  //make instance from class inheritance, to make object
 Cat cat1 = Cat(name: "Blacky", fur: "soft");

This is slot in react js (use props)

  1. Make Component
//use react v16 or avove, to avoid import React Class
import { Breadcrumb, Typography } from 'antd';
import style from "../assets/style/custom/custom.module.css";

const Breadcrumbs = ({ bg, children, ...props }) => { /* restparameter (...) the last parameter use it,
@hdinjos
hdinjos / slot.md
Last active January 18, 2022 04:02
slot in vuejs

Slot, for reusable component

base

example in exampleSlot.vue:

<p>
    <slot></slot>
@hdinjos
hdinjos / Knex-Migrations-Seeding.md
Created June 1, 2021 16:07 — forked from NigelEarle/Knex-Migrations-Seeding.md
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

@hdinjos
hdinjos / fk_psql.md
Last active May 25, 2021 06:38
foreign key posgresql

create table with foreign key default, prequities must have to table

  1. create transaction_types table CREATE TABLE transaction_types(id serial primary key, code varchar(20), name varchar(100));
  2. create transactions table to relation with transaction_type table CREATE TABLE transactions(id serial primary key, type_id int, trans_code varchar(20), trans_date date, FOREIGN KEY(type_id) REFERENCES transaction_types(id));

create table with foreign key with delete, prequities must have to table

  1. create transaction_types table CREATE TABLE transaction_types(id serial primary key, code varchar(20), name varchar(100));
  2. create transactions table to relation with transaction_type table
@hdinjos
hdinjos / Relationship-between-model-sequelize.md
Created March 22, 2021 17:41
Relationship between model sequelize

Relationship in sql database with sequelize or not

example conditions:

Now, we need to define the associations between our user and book model. As a user, I should be able to have as many books as possible while a book should belong to a particular user. So our user model is going to have a One-to-many relationship with the book model while our book model would have a many-to-one relationship with the user model.

with example above we know:

  • 1 user can have many books ==> in relationalship model or table is one to many
  • many/particular books belong to 1 user ==> in relationalship model or table is many to one
@hdinjos
hdinjos / event-listener-js.md
Created January 23, 2021 02:02
note event listener

The event listeners need to be removed due to following reason.

  • Avoid memory leaks, if the browser is not handled it properly. Modern browsers will garbage collect event handlers of removed DOM elements but it is not true in cases of legacy browses like IE which will create memory leaks.
  • Avoid collisions of events of components.
  • Remove the side effects when the reference of event listeners are stored in some persistence such as local storage or some thing like this

Running on Linux praxis-20dss1yx2l 5.8.16-2-MANJARO #1 SMP PREEMPT Mon Oct 19 11:33:03 UTC 2020 x86_64 GNU/Linux

Mengaktifkan mongodb di terminal

$ mongo

Melihat semua database

@hdinjos
hdinjos / emulator-install-using-avdmanager.md
Created October 19, 2020 01:21 — forked from mrk-han/emulator-install-using-avdmanager.md
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For generic skin emulator with default apis (without google apis):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-29;default;x86"