This file contains hidden or 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
[ | |
{ | |
"name": "Wireless Bluetooth Headphones", | |
"category": "Electronics", | |
"price": 49.99, | |
"description": "High-quality wireless Bluetooth headphones with noise cancellation." | |
}, | |
{ | |
"name": "Smartphone with 64GB Storage", | |
"category": "Electronics", |
This file contains hidden or 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, { useState } from "react" | |
let intervalId; | |
function StopWatch() { | |
const [counter, setCounter] = useState(0) | |
const handleClick = (action) => { | |
switch(action){ | |
case 'start' : { | |
intervalId = setInterval(() => { |
This file contains hidden or 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 { useRef, useState } from "react"; | |
function SimpleCurrency () { | |
const [convertedValue, setConvertedValue] = useState(0); | |
const rates = [ | |
{ | |
from: 'USD', | |
to: 'LKR', | |
rate: 297 | |
}, |
This file contains hidden or 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
//we have a function to accept arguments and return it. | |
const toArray = (arg1,arg2,arg3) => { | |
return [arg1,arg2,arg3]; | |
}; | |
/** | |
* now what we need to do it to make the function for to accept | |
* multiple number of arguments. | |
*/ | |
const toArray = (...args) => { |
This file contains hidden or 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
//intiate an object of a person | |
const person = { | |
name: "Mark", | |
age: 28, | |
greet() { | |
console.log("Hello, World"); | |
}, | |
}; | |
//copy all the person attribute to another copyOfPerson obje |
This file contains hidden or 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
//we are initiate an array | |
const hobbies = ["Sports", "Cooking"]; | |
//we are copy all the elements to the copyOfHobbies array | |
const copyOfHobbies = [...hobbies]; | |
/** | |
* we are copy all the elements of the copyOfHobbies array into | |
* copyOfHobbies2 array and adding one more hobby to there | |
*/ |
This file contains hidden or 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
#!/bin/bash | |
###################################################### | |
### README ########################################### | |
###################################################### | |
### | |
### One-line server install script for Ubuntu. | |
### Installs Nginx + PHP7.1 + MongoDB for PHP driver. | |
### | |
### Removes previous Apache, PHP, nginx installations. |
This file contains hidden or 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 reponseArray = []; | |
// Printing Job | |
async function printer(barcode,productLine,numberOfCopies,rcvdDate) { | |
var xmlHttp = new XMLHttpRequest(); | |
xmlHttp.open("GET", '/barcode/get-script-url?barcode='+barcode+'&productLine='+productLine+'&numberOfCopies='+numberOfCopies+'&rcvdDate='+rcvdDate+'', false); // false for synchronous request | |
xmlHttp.send(null); | |
var response = await xmlHttp.responseText; | |
var responseObj = JSON.parse(response); | |
loadScript(responseObj.scripturl, function () { |
This file contains hidden or 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
[ | |
{ | |
"student_name" : "Nifras", | |
"studen_id" : "001", | |
"amount" : "300", | |
"invoice" : "55151", | |
"date" : "2017-07-06", | |
"time" : "08:00PM", | |
"class" : "Thilina Sri Grade 11", | |
"paid_for" : "April 2008", |
This file contains hidden or 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
<div class="form-group"> | |
<label for="user_role">User Roles</label> | |
<div id="user_role" class="checkbox" *ngFor="let role of roles"> | |
<div class="col-sm-4"> | |
<label> | |
<input type="checkbox" | |
value="{{role.id}}" | |
[checked]=role.status | |
(change)="changeRole(role)"/> | |
{{ role.role_name }} |
NewerOlder