Skip to content

Instantly share code, notes, and snippets.

View nifrasismail's full-sized avatar
🏁
MicroService Based API Developer

Nifras Ismail nifrasismail

🏁
MicroService Based API Developer
View GitHub Profile
[
{
"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",
import React, { useState } from "react"
let intervalId;
function StopWatch() {
const [counter, setCounter] = useState(0)
const handleClick = (action) => {
switch(action){
case 'start' : {
intervalId = setInterval(() => {
@nifrasismail
nifrasismail / SimpleCurrency.js
Last active May 27, 2024 11:59
React Currency Converter - Simple Way
import { useRef, useState } from "react";
function SimpleCurrency () {
const [convertedValue, setConvertedValue] = useState(0);
const rates = [
{
from: 'USD',
to: 'LKR',
rate: 297
},
//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) => {
//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
//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
*/
@nifrasismail
nifrasismail / Ubuntu server setup script (PHP 7.1)
Created November 19, 2018 11:09 — forked from Ravaelles/Ubuntu server setup script (PHP 7.1)
PHP 7.1 + nginx + MongoDB driver for PHP
#!/bin/bash
######################################################
### README ###########################################
######################################################
###
### One-line server install script for Ubuntu.
### Installs Nginx + PHP7.1 + MongoDB for PHP driver.
###
### Removes previous Apache, PHP, nginx installations.
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 () {
[
{
"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",
<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 }}