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 / 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;
@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 / JsonConverterUtil.java
Created July 4, 2019 08:51
JsonConverterUtil helps to convert object to JSON string
package nl.abnamro.ignition.api.common.util;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* JsonConverterUtil helps to convert object to JSON string
*/
@ggluta
ggluta / JsonConversionException.java
Created July 4, 2019 08:53
A wrapper for exceptions occuring while converting to JSON (see JsonConversion class)
package nl.abnamro.ignition.api.common.util;
/**
*
*
* A wrapper for exceptions occuring while converting to JSON
*
*
*/
public final class JsonConversionException extends RuntimeException {
@ggluta
ggluta / ErrorDetails.java
Created July 4, 2019 09:35
Wrapper over the JSONs sent by the error mapper in Spring
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Getter;
import nl.abnamro.ignition.api.common.domain.model.Violation;
@JsonInclude(JsonInclude.Include.NON_NULL)
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@ggluta
ggluta / index.html
Created July 5, 2020 22:56
Web design with dark landing page
<div class='page'>
<nav>
<a href='#'>Browse</a>
<a href='#'>Support</a>
<a href='#'>Blog</a>
<a href='#'>Sign in</a>
<a href='#'>
<div class='button'>
Sign up
</div>
@ggluta
ggluta / component.js
Last active September 17, 2020 18:14
// STEP 1 - DEFINING TEMPLATE STRUCTURE AND STYLES
// creating the template
const template = document.createElement('template');
// styles and HTML templating structure goes right here
template.innerHTML = `
<style>
.wrapper {
// STEP 1 - DEFINING TEMPLATE STRUCTURE AND STYLES
// creating the template
const template = document.createElement('template');
// styles and HTML templating structure goes right here
template.innerHTML = `
<style>
.wrapper {
// STEP 2 - DEFININING COMPONENT BEHAVIOUR
class AwesomeComponent extends HTMLElement {
constructor() {
super();
// enables to access the shadowDom through the shadowRoot
const shadow = this.attachShadow({ mode: 'open' });
// we are going to attach the template to the shadowRoot ( || shadowDOM)
shadow.appendChild(template.content.cloneNode(true));
}