Skip to content

Instantly share code, notes, and snippets.

View Bviveksingh's full-sized avatar
🙂
Focusing

Vivek Singh Bisht Bviveksingh

🙂
Focusing
View GitHub Profile
<ion-header>
<ion-toolbar>
<ion-title>
Access Location
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-item style="cursor: pointer;margin-top:100px;" (click)="onpickupClick()">
<ion-icon slot="start" name="locate"></ion-icon>
@Bviveksingh
Bviveksingh / line_of_code.js
Last active July 4, 2022 22:56
Line of code breakpoint example
const getInfo = (json) => {
const obj = JSON.parse(json);
const name = getName(obj);
const id = getAge(obj);
const rollNumber = getRollNumber(obj);
return `The student name is ${name} and id is ${id + rollNumber}`;
}
const json = '{"firstName": "Vivek","lastName": "Bisht",
@Bviveksingh
Bviveksingh / return_line_of_code.txt
Created July 4, 2022 22:57
Return value of line_of_code
The student name is VivekBisht and id is function () { return 30; }3451
@Bviveksingh
Bviveksingh / target_object.js
Created August 14, 2022 09:25
Target object
const targetObj = {
name: "Ryan",
age: 34
};
@Bviveksingh
Bviveksingh / proxy_object.js
Created August 14, 2022 09:27
proxy object creation
const proxyObj = new Proxy(targetObj, handler);
@Bviveksingh
Bviveksingh / handler_object.js
Last active August 14, 2022 10:01
Handler object
const handler = {
get: function(target, property){
},
set: function(target, property, value){
}
};
@Bviveksingh
Bviveksingh / get_method_proxy.js
Created August 14, 2022 09:45
writing get method
const handler = {
get: function(target,property) {
if(property === "name"){
return `Name of the person is ${target[property]}`
}
},
}
@Bviveksingh
Bviveksingh / setter_method_proxy.js
Last active August 14, 2022 10:13
setter method for proxy
const handler = {
set: function (target, property, value){
if(property === "age"){
if(typeof value == "string"){
alert("Cannot assign String to age, use Number only");
}
else{
target[property] = value;
}
}
@Bviveksingh
Bviveksingh / new_proxy.js
Created August 14, 2022 11:43
new proxy object
const proxyObj = new Proxy(getTargetObj(), handler);
const handler = {
get: async (target, date) => {
if(target[date]){
return target[date];
}
else{
const dataRaw = await fetch(`https://api.nasa.gov/planetary/apod?api_key=${apiKey}&date=${date}`, {
method : "GET",
mode: 'cors',
});