These patterns are implemented using Java 8 Lambdas (together with Project Lombok annotations).
Enum class:
| /** | |
| * | |
| * Licensed to the Apache Software Foundation (ASF) under one or more | |
| * contributor license agreements. See the NOTICE file distributed with | |
| * this work for additional information regarding copyright ownership. | |
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| * (the "License"); you may not use this file except in compliance with | |
| * the License. You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| import { Component, HostListener } from '@angular/core'; | |
| @Component({ | |
| selector: 'app-keyboard-listener', | |
| templateUrl: './keyboard-listener.component.html', | |
| styleUrls: ['./keyboard-listener.component.css'] | |
| }) | |
| export class KeyboardListenerComponent { | |
| // Listener just for one key |
Go is a statically typed, compiled programming language designed at Google. Go is syntactically similar to C, but with memory safety, garbage collection, structural typing, and CSP-style concurrency.
This cheat sheet is prepared by refering the book Introducing Go Build Reliable, Scalable Programs by Caleb Doxsey
my personal go note
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| ) | |
| type example struct { | |
| Name string | |
| Address string |
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| ) | |
| func main() { | |
| // Create a map to parse the JSON | |
| var data map[string]interface{} |
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| type Barista struct { | |
| name string |