This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stateless | |
const name = 'topidesta'; | |
function helloName() { | |
return <div>Hello { name } </div>; | |
} | |
# Statefull | |
class helloName extends React.Component { | |
state = { name: 'topidesta' }; | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
class StopWatch extends Component { | |
state = { | |
timerOn: false, | |
timerStart: 0, | |
timerTime: 0, | |
lastTime: null, | |
}; | |
startTime = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Atom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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; |