Skip to content

Instantly share code, notes, and snippets.

View mdestafadilah's full-sized avatar
🧠
I'm an Intuiting Ekstrovert (IE) with B Blood Type.

mDestaFadilah mdestafadilah

🧠
I'm an Intuiting Ekstrovert (IE) with B Blood Type.
View GitHub Profile
@mdestafadilah
mdestafadilah / Top 10 Interview Questions with Coding Examples 2023
Created January 30, 2023 08:57
Top 10 Interview Questions with Coding Examples 2023
What is closure in JavaScript and how does it work?
Answer: Closure is a feature in JavaScript where a function has access to its outer scope even after the outer function has returned. It is created when a function is defined inside another function, and the inner function retains access to the variables in the outer function's scope.
Can you explain hoisting in JavaScript?
Answer: Hoisting is a behavior in JavaScript where variable and function declarations are moved to the top of their scope, regardless of where they are declared in the code. This means that variables and functions can be called before they are declared, but the value of variables will be undefined until they are assigned a value.
What is the difference between == and === in JavaScript?
@mdestafadilah
mdestafadilah / USER MYSQL
Created January 10, 2023 04:37
USER MYSQL
```
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
@mdestafadilah
mdestafadilah / VITE JS ANTD
Created August 5, 2022 09:43
VITE JS ANTD
https://segmentfault.com/a/1190000041225133/en
@mdestafadilah
mdestafadilah / MUI-WIZARD-FORM
Created June 3, 2022 02:06
MUI-WIZARD-FORM
https://dev.to/paulvermeer2021/turn-any-form-into-a-stepper-form-wizard-with-ui-hooks-context-react-hook-form-and-yup-56j6
https://codesandbox.io/s/cranky-monad-52bh5w
https://blog.logrocket.com/building-multi-step-wizards-with-formik-and-react-query/
https://codesandbox.io/s/wizard-form-with-formik-forked-n7uxd9?file=/package.json
@mdestafadilah
mdestafadilah / BACKUP DB MYSQL DUMP
Created May 30, 2022 09:05
BACKUP DB MYSQL DUMP
$this->load->helper(array('url','file','download'));
$this->load->library('zip');
$website = $this->load->database('website', TRUE); // the TRUE paramater tells CI that you'd like to return the database object.
$DBUSER=$website->username;
$DBPASSWD=$website->password;
$DATABASE=$website->database;
$HOSTNAME=$website->hostname;
system\database\drivers\mysqli\mysqli_utility.php
```
/**
* MySQLi Export
*
* @access private
* @param array Preferences
* @return mixed
* @source https://stackoverflow.com/a/44667873
*/
@mdestafadilah
mdestafadilah / bash-rename
Created May 10, 2022 07:54
RENAME JS TO JSX FOR VITEJS FROM CRA - REACTJS PROJECT
source:
1. https://medium.com/@sheniff/using-shell-to-rename-files-in-bulk-ee657f1a06
2. https://gist.github.com/mustafaturan/32df16bb4c49fbd837f777000f4b9aa2?permalink_comment_id=3837386#gistcomment-3837386
How to:
1. Create file, ex: renamejstojsx.sh copy paste from source:#1
2. In your project open bash or Cmder as Terminal execution
3. Run ```bash renamejstojsx.sh```
4. Done, sruput coffe again.
@mdestafadilah
mdestafadilah / datetime
Created April 28, 2022 03:02
TOPIDESTA POSTING
https://stackoverflow.com/a/1296398/1852097
https://stackoverflow.com/a/67553979/1852097
```javascript
var dateOffset = (24*60*60*1000) * 12775; //5 days
var myDate = new Date();
console.log(dateOffset);
```
https://unitconverter.io/years/days/35
@mdestafadilah
mdestafadilah / YUP
Created April 25, 2022 05:40
LOOPING DI YUP OBJECT
const schema = yup.object().shape({
filelamaran: yup.mixed().test('fileSize', "File Lamaran terlalu besar bro.. kurang dari < 500Kb ya!", val => validasiSizeFile(val) === true).test('fileType',"File harus PDF bro.. Ukuran PDF < 500Kb ya!", val => validasiTipeFile(val) === true).nullable(),
filefoto: yup.mixed().test('fileSize', "File Foto terlalu besar bro.. kurang dari < 500Kb ya!", val => validasiSizeFile(val) === true).test('fileType',"File harus PDF bro.. Ukuran PDF < 500Kb ya!", val => validasiTipeFile(val) === true).nullable(),
fileriwayat: yup.mixed().test('fileSize', "File Riwayat terlalu besar bro.. kurang dari < 500Kb ya!", val => validasiSizeFile(val) === true).test('fileType',"File harus PDF bro.. Ukuran PDF < 500Kb ya!", val => validasiTipeFile(val) === true).nullable(),
fileijazah: yup.mixed().test('fileSize', "File Ijazah terlalu besar bro.. kurang dari < 500Kb ya!", val => validasiSizeFile(val) === true).test('fileType',"File harus PDF bro.. Ukuran PDF < 500
@mdestafadilah
mdestafadilah / array_kolom
Created March 16, 2022 01:19
Kolom array yang tidak ada di PHP 5.4
# source: https://stackoverflow.com/a/33919648
# using for php < 5.4 if server using > 5.5 please, use array_columnt instead
if (!function_exists('arr_kolom')) {
function arr_kolom(array $array, $columnKey, $indexKey = null)
{
$result = array();
foreach ($array as $subArray) {
if (!is_array($subArray)) {
continue;
} elseif (is_null($indexKey) && array_key_exists($columnKey, $subArray)) {