Skip to content

Instantly share code, notes, and snippets.

View fasidOnGit's full-sized avatar
🏠
Working from home

Kader Mohideen Fasid fasidOnGit

🏠
Working from home
View GitHub Profile
class BookWithReviews {
constructor(id, title) {
this.id = id;
this.title = title;
this.reviews = [];
}
addReview(author, content) {
this.reviews.push({ author, content });
};
<!DOCTYPE html>
<html ​​ng-app​=​"plunker">
<head>
<meta​​ charset​=​"utf-8"​​/>
<title>​AngularJS Plunker​</title>
<script>​document​.​write​(​'<base href="'​​+​ document​.​location ​+​​'"/>'​);​</script>
<link​​rel​=​"stylesheet"​​href​=​"style.css"​​/>
<script​​ data-require​=​"[email protected]"src​=​"​https://code.angularjs.org/1.5.8/angular.js"​​data-semver​=​"1.5.8"​></script><script​​src​=​"app.js"​></script>
</head>
<body​​ ng-controller​=​"MainCtrl">
class MyComponent extends React.Component {
constructor(props) {
// set the default internal state
this.state = {
clicks: 0
};
}
componentDidMount() {
this.refs.myComponentDiv.addEventListener('click', this.clickHandler);
/**
* Flattens any levels of nested arrays into single level
* @author Kader Fasid([email protected])
* @params {Array} - Nested Array to Flatten
* @returns {Array} - Flattened array.
*/
const flatten = (input) => {
var arr = [];
const recursiveArr = (input) => {
if(Array.isArray(input)) {
function email(email) {
if(typeof email !== "undefined"){
let lastAtPos = email.lastIndexOf('@');
let lastDotPos = email.lastIndexOf('.');
if (!(lastAtPos < lastDotPos && lastAtPos > 0 && email.indexOf('@@') == -1 && lastDotPos > 2 && (email.length - lastDotPos) > 2)) {
formIsValid = false;
return console.log("Email is not valid");
}
return console.log('valid')