Skip to content

Instantly share code, notes, and snippets.

View jx13xx's full-sized avatar
🎯
Focusing

Jean Xavier jx13xx

🎯
Focusing
  • Dubai, United Arab Emriates
View GitHub Profile
@jx13xx
jx13xx / ListProduct.java
Last active August 1, 2020 17:57
Create a Marshalling program on Java which converts objects into data format suitable for storage and transmission. Included with the POJO Class (Getters & Setters methods)
package com.company;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name ="products")
@jx13xx
jx13xx / APIFunctionCall.java
Last active August 2, 2020 15:05
Fetctching API response from http://api.ipinfodb.com and converting them to Java Objects. Similiar strategy can be used for other APIs, also includes the implementation of POJO classes (Getters & Setters method)
package com.company;
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
@jx13xx
jx13xx / Airline.java
Last active August 2, 2020 15:01
Converting a XML File to Another XML File using the XSLT Conversion method on Java
package com.company;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name="airline")
public class Airline {
private String airlineName;
private int seatsAvailable;
@jx13xx
jx13xx / ReadME.md
Created August 7, 2020 11:53
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test)

You are missing one of the plugins in your POM.xml just add the following plugins
and you mvn clean install

Add the Surface Plugin

 <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-surefire-plugin</artifactId>
     <version>2.19.1</version>
@jx13xx
jx13xx / ReadME.md
Created August 7, 2020 12:07
No goals have been specified for this build. Maven Project built issues

Inside the tag put the default to fix the errors

<build>compile</build>
@jx13xx
jx13xx / CompareArrays.js
Created January 18, 2022 08:18
Comparing Two Arrays in Optimized Way 0(n)
function itemInCommon(arr1, arr2) {
let obj = {}
for(let i = 0; i < arr1.length; i++)
obj[arr1[i]] = true
for (let i = 0; i < arr1.length; i++) {
obj[arr1[i]] = true
}
for (let j = 0; j < arr2.length; j++) {
if (obj[arr2[j]]) return true
@jx13xx
jx13xx / filter.js
Created January 18, 2022 08:44
Filtering search in array using arrow method
const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
const result = words.filter(word => word.length > 6);
const containsE = words.filter(word => word.match(/[e]/g) );
console.log(containsE);
console.log(result);
@jx13xx
jx13xx / EmailValidationCheck.js
Created January 19, 2022 08:54
Email Validation in Javascript
let cases = {
'firstName' : 'FirstName',
'lastName' : 'LastName',
'email': '[email protected]',
'salary': 500235
}
const verifiedEmail = !!cases["email"].match(/([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/)
// OR
@jx13xx
jx13xx / Rectangle.js
Created January 26, 2022 11:44
Liskov Substitution Principle
class Rectangle extends Shape {
constructor(width, height){
super();
this.width = width;
this.height = height;
}
getArea(){
return this.width * this.height;
}
@jx13xx
jx13xx / EmailValidationCheck.js
Created January 26, 2022 18:15
EmailValidationCheck
let cases = {
'firstName' : 'FirstName',
'lastName' : 'LastName',
'email': '[email protected]',
'salary': 500235
}
const verifiedEmail = !!cases["email"].match(/([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/)
// OR