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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@mdestafadilah
mdestafadilah / Component React
Created May 4, 2020 23:39
STATELESS DAN STATEFULL
# Stateless
const name = 'topidesta';
function helloName() {
return <div>Hello { name } </div>;
}
# Statefull
class helloName extends React.Component {
state = { name: 'topidesta' };
render() {
function forceDownload(url,filename) {
// source: https://stackoverflow.com/a/57778370
let xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "blob";
xhr.onload = function(e) {
if (this.status == 200) {
const blob = this.response;
const a = document.createElement("a");
document.body.appendChild(a);
@mdestafadilah
mdestafadilah / gist:824078f8d83109e499aeaf5376bf2d8c
Created December 15, 2020 07:41
Paging Codeigniter, How to solve it!!
# https://stackoverflow.com/a/20189242
# https://stackoverflow.com/a/44030969
# https://stackoverflow.com/a/14462425
# https://stackoverflow.com/a/7966905
# https://stackoverflow.com/a/21116201
@mdestafadilah
mdestafadilah / StopWatch
Created December 30, 2020 07:38
StopWatch
import React, { Component } from "react";
class StopWatch extends Component {
state = {
timerOn: false,
timerStart: 0,
timerTime: 0,
lastTime: null,
};
startTime = () => {
@mdestafadilah
mdestafadilah / YUP
Created February 1, 2021 08:26
YUP CHECK VALIDASI PASSWORD
Yup.object().shape({
password: Yup.string()
.required('Required'),
confirmPassword: Yup.string()
.oneOf([Yup.ref('password'), null], "Passwords don't match!")
.required('Required')
});
SOURCE: https://medium.com/@sagar.shrestha/yup-validate-if-the-values-of-two-fields-are-the-same-12c1e997920
@mdestafadilah
mdestafadilah / SCALEDRONE
Created March 26, 2021 03:19
SCALEDRONE
$channel_id = "K3gfQWyPfnlARdfu";
$channel_secret = "ilQTV3cM7LzSqS9QM4RBudK38Ohdvnai";
$room_name = "surat";
$auth = base64_encode("$channel_id:$channel_secret");
$url = "https://api2.scaledrone.com/$channel_id/$room_name/publish";
$data = array('key1' => 'value1', 'key2' => 'value2');
$options = array(
'http' => array(
Atom
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
body {
font-size: 16px;
font-family:Candara,Calibri,Segoe,Segoe UI,Optima,Arial,sans-serif;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
body {
font-size: 16px;
font-family:Candara,Calibri,Segoe,Segoe UI,Optima,Arial,sans-serif;