Skip to content

Instantly share code, notes, and snippets.

View jsbonso's full-sized avatar
🎯
portal.tutorialsdojo.com

Jon Bonso jsbonso

🎯
portal.tutorialsdojo.com
View GitHub Profile
@jsbonso
jsbonso / gist:cf52cf28588c53f2c269a265ecf4e184
Created May 15, 2018 13:46
Compilation of Various Core Java Questions
1. Will two objects with the same hashcode always be equal to each other?
A. Yes
B. No
C. Only when using inheritance
D. Two objects can never have the same hashcode
2. What does it mean to declare a private method as final?
A. It can only be called once.
B. It is called upon garbage collection
C. A subclass cannot override it
@jsbonso
jsbonso / hi.js
Created April 8, 2018 05:11
Hello World NodeJS
// Import HTTP Module
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
// Create Server
const server = http.createServer((request, response) => {
@jsbonso
jsbonso / Arithmetic Slice.js
Created October 27, 2017 08:46
Arithmetic Slice
/*
* Returns the number of arithmetic slices in
* the given number array.
*
* Examples:
* [-1, 1, 3, 3, 3, 2, 1, 0] = 5
*
* A sequence is an Arithmetic if:
* 1. It consists of 3 elements
* 2. The difference between any two consecutive
@jsbonso
jsbonso / How to connect Java to MySQL.java
Created October 23, 2017 20:57
How to connect Java to MySQL Database
package com.tutorialsdojo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSetMetaData;
/**
@jsbonso
jsbonso / Primer to GraphQL
Created October 19, 2017 05:30
Primer to GraphQL
The What, When and Why of GraphQL
In our previous lecture, we had a good introduction of what GraphQL is
by looking at the common issues of a RESTful API, and how GraphQL solves
and improves
Those certain issues.
This time, we will dive deeper on what GraphQL is,
the story on how it came to be
@jsbonso
jsbonso / Docker CheatSheet.txt
Last active October 19, 2017 05:33
Docker Commands CheatSheet
-- Show all images
docker images -a
-- Show all containers
docker volume ls
-- Removes dangling/unused container
docker volume prune
-- Basically similar with (docker volume prune) command.
@jsbonso
jsbonso / gist:9536da07adbfed4cbdef1b2512f4c319
Created October 18, 2017 04:53
Available Stock API that you can use
/**
* https://www.bloomberg.com/markets/watchlist/recent-ticker/GOOG:US
* https://www.bloomberg.com/markets/chart/data/1D/GOOG:US
*/
@jsbonso
jsbonso / Java Contains Sum.java
Created October 17, 2017 05:56
Java - Checks if the number is a sum of any of the 2 numbers in the list
import java.util.Arrays;
public class App {
public static void main( String[] args ) {
int[] inArray = {1, 3, 3, 5, 7};
int baseNum = 6;
System.out.println("Number List: " + Arrays.toString(inArray) );
@jsbonso
jsbonso / Remove an Element from a List using CopyOnWriteArrayList.java
Created October 15, 2017 23:41
How to safely remove an element from a List using CopyOnWriteArrayList
/**
*
* How to safely remove an element from a List using
* CopyOnWriteArrayList
*
* @author jonbonso
* @param args
*/
public static void main( String[] args ) {
@jsbonso
jsbonso / Java Stream Filter Example.java
Created October 15, 2017 01:04
Java Stream Filter Examples
/**
* filter() example of Java's Stream API
*
*
* How to get certain items from a collection using the filter()
* intermediate operation, and then show the result using the
* collect() terminal operation.
*
* @author jonbonso
* @param args