Skip to content

Instantly share code, notes, and snippets.

View ggluta's full-sized avatar
👽
Let's jam!

George Gabriel Luță ggluta

👽
Let's jam!
View GitHub Profile
@ggluta
ggluta / Features.java
Created April 2, 2019 13:23
Java 8 features
public class Features {
// made it static so it can be called from main
private static int addOne(int value) {
return ++value;
}
public static void main(String[] args) {
// ==================== Functional interfaces and lambdas ====================
@ggluta
ggluta / async-await.js
Created November 17, 2018 15:17
async/await vs raw Promises examples
const fetch = require('node-fetch')
const fetchUserAvatar = async (userId) => {
const response = await fetch(`http://catappapi.herokuapp.com/users/${userId}`)
response // actual response, not the promise
const data = await response.json(); // without await, data will be a promise that resolves to the desired data
data
return data.imageUrl;