Skip to content

Instantly share code, notes, and snippets.

View rintoandrews90's full-sized avatar
:octocat:

Rinto Andrews rintoandrews90

:octocat:
View GitHub Profile
/*******
* Variable Mutation & Coercion
* To mutate a variable once it has been defined means to alter its value.
*/
var firstname = 'john';
console.log(firstname);
//1.String Type
var lastname = 'smith';
var firstname = 'john"';
console.log(firstname);
//String Type
var lastname = 'smith';
//Number Type
var age = 28;
console.log(age);
//Install Swift Linit
//brew install swiftlint
//Run Swiftlint autocorrect while building app.
//Build Phases => New Run Script Phase
if which swiftlint >/dev/null; then
swiftlint autocorrect
@rintoandrews90
rintoandrews90 / LoadStaticHTMLNode.js
Created August 11, 2019 14:05
Load static html pages
// npm init -y
//npm install express --save
const path = require('path')
const express = require('express')
console.log(__dirname);
@rintoandrews90
rintoandrews90 / HTMLJSONGet.js
Created August 11, 2019 13:36
Return JSOM/HTML for Get
// npm init -y
//npm install express --save
const express = require('express')
const app = express()
@rintoandrews90
rintoandrews90 / APIGetMethodsRoutes.js
Created August 11, 2019 13:23
API GET Methods Node
// npm init -y
//npm install express --save
const express = require('express')
const app = express()
@rintoandrews90
rintoandrews90 / ShortHandNode.js
Created August 11, 2019 07:40
Short Hand Node.js
//Install HTTP Request
// npm init -y
// npm i request
const request = require('request')
const wheather = (latitude,longitude,callback) => {
@rintoandrews90
rintoandrews90 / ShortHandNodeAndDestructure.js
Last active August 17, 2019 05:54
Short hand & destructure node.js
const name ='rinto'
const age = 10
const user = {
name,
age,
location:'thrissur'
}
console.log(user)
@rintoandrews90
rintoandrews90 / CallAPIinsideAnotherAPI.js
Created August 11, 2019 07:13
Call one API inside another API
//Install HTTP Request
// npm init -y
// npm i request
const request = require('request')
const wheather = (latitude,longitude,callback) => {
@rintoandrews90
rintoandrews90 / NodeCallbackwithAPI.js
Created August 11, 2019 06:30
Node Callback with API
const geoCode = (address,callback) => {
const gioCodeURL = 'https://api.mapbox.com/geocoding/v5/mapbox.places/'+ encodeURIComponent(address) + '.json?access_token=pk.eyJ1IjoicmludG8iLCJhIjoiY2p6NmllczBiMG1nbjNucG5qZjVqOXZwZSJ9.qu2LrgatHMB-so2E4oHaFA&limit=1'
request({url:gioCodeURL,json:true}, (error,response) => {
if (error) {
callback('Unable to connect to wheather API',undefined)
} else if (response.body.features.length == 0){
callback('Unable to find location, try another location',undefined)
} else {
const latitude = response.body.features[0].center[0]