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
// Importing the required modules | |
const express = require('express'); | |
const mongoose = require('mongoose'); | |
const read = require('stream-read'); | |
const fs = require('fs'); | |
// initialising the app | |
const app = express(); | |
const mongoURI = 'XXX' |
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'; | |
import { StyleSheet, View, Button } from 'react-native'; | |
import Mapbox from '@mapbox/react-native-mapbox-gl'; | |
Mapbox.setAccessToken('My Token'); | |
export default class App extends Component { | |
constructor(props) { |
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'; | |
import { StyleSheet, View } from 'react-native'; | |
import Mapbox from '@mapbox/react-native-mapbox-gl'; | |
Mapbox.setAccessToken('MY-PUBLIC-KEY'); | |
export default class App extends Component { | |
constructor(props) { |
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
<html> | |
<head> | |
<title>Pomodoro Clock</title> | |
<style> | |
@import url('https://fonts.googleapis.com/css?family=Berkshire+Swash'); | |
</style> | |
</head> | |
<body> | |
<div class="container" id="container"> | |
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
<html> | |
<head> | |
<title>Javascript Calculator</title> | |
<style> | |
@import url('https://fonts.googleapis.com/css?family=Orbitron'); | |
@import url('https://fonts.googleapis.com/css?family=Dancing+Script'); | |
</style> | |
</head> | |
<body> | |
<div class="container" id="container"> |
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
<html> | |
<head> | |
<title>Javascript Calculator</title> | |
<style> | |
@import url('https://fonts.googleapis.com/css?family=Orbitron'); | |
@import url('https://fonts.googleapis.com/css?family=Dancing+Script'); | |
</style> | |
</head> | |
<body> | |
<div class="container" id="container"> |
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
1. getTokens(rawString) : -This function takes an argument(rawString) and returns the array of words in rawString. | |
-This function uses some built in functions such as toLowerCase(), fliter(),split() and | |
sort(). | |
-The fliter(Boolean) filters all the falsy values from an array. | |
-Inside the split() function a regular expression is written which helps in splitting the | |
words in the text. | |
2. mostFrequentWord() : -Inside this function a variable "words" is defined which stores the array of the words | |
which is returned by the function getTokens(). | |
-Also an empty object wordFrequency is defined which will store the frequency of each | |
word in the words 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
var scratchData = [ | |
{id: 22, foo: 'bar'}, | |
{id: 28, foo: 'bizz'}, | |
{id: 19, foo: 'bazz'} | |
]; | |
function findById(items, idNum) { | |
return items.find(function(item) { | |
return item.id === idNum; | |
}); |
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 createMyObject() { | |
var myObject = { | |
foo : 'bar', | |
answerToUniverse: 42, | |
'olly olly': 'oxen free', | |
sayHello: function(){ | |
return 'hello'; | |
} | |
} | |
return myObject; |
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
When a function alters values outside of the scope then we call it a 'side effect'. Side effects can be both bad and good. When a function is intended to alter the values outside it's scope, then it not a problem. But it creates a problem when it is unintended and alters the values outside of it's scope. When this happens, the function starts returning different values whenever it is called with same set of values. |
NewerOlder