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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Web Components playground</title>
</head>
<body>
// STEP 3 - REGISTER THE NEW COMPONENT AS A CUSTOM HTML TAG
window.customElements.define('awesome-component', AwesomeComponent);
// 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));
}
// 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 {
@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 {
@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>
$ 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 / 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)
@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 / 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
*/