Skip to content

Instantly share code, notes, and snippets.

Avatar
:atom:
Just Find Some Lucky in Freelance Skill

mDestaFadilah mdestafadilah

:atom:
Just Find Some Lucky in Freelance Skill
View GitHub Profile
@mdestafadilah
mdestafadilah / REMOVE NODE_MODULES
Last active February 28, 2023 07:32
REMOVE NODE_MODULES
View REMOVE NODE_MODULES
find . -name "node_modules" -type d -prune -print -exec rm -rf '{}' \ ;
OR
rm -rf $(find / -type d -name node_modules);
OR
rm -rf $(find . -name "node_modules" -type d -prune -print -exec rm -rf '{}' \ );
@mdestafadilah
mdestafadilah / RANDOM NUMBER IN PHP
Created February 9, 2023 02:48
RANDOM NUMBER IN PHP
View RANDOM NUMBER IN PHP
<?php
$date = date("Y-m-d H:i:s");
$day_number = date('N', strtotime($date));
echo $day_number;
echo "\n";echo "===="; echo "\n";
echo ($day_number % 2 == 0) ? '1' : '2';
echo "\n";
function generateRandomBot($min = 1, $max = 2)
{
@mdestafadilah
mdestafadilah / Top 10 Interview Questions with Coding Examples 2023
Created January 30, 2023 08:57
Top 10 Interview Questions with Coding Examples 2023
View 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
View 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
View VITE JS ANTD
https://segmentfault.com/a/1190000041225133/en
@mdestafadilah
mdestafadilah / MUI-WIZARD-FORM
Created June 3, 2022 02:06
MUI-WIZARD-FORM
View 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
View 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;
View BACKUP DB CI
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
View bash-rename
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
View datetime
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