Skip to content

Instantly share code, notes, and snippets.

View structequality0.go
type Employee struct {
firstName string
secondName string
id int
}
View structequality1.go
package main
import (
"fmt"
"reflect"
)
type Employee struct {
firstName string
secondName string
id int
View structequality2.go
package main
import (
"fmt"
"reflect"
)
type Employee struct {
firstName string
secondName string
id *int
View Main.java
public static void main(String[] args) {
Device device = new Television();
Remote remote = new Remote(device);
// Turn TV on
Command cmd = new TurnTVOn(device);
cmd.execute();
//Turn TV Off
cmd = new TurnTVOff(device);
View Remote.java
public class Remote {
Device device;
public Remote(Device device) {
this.device = device;
}
}
View CommandImplementations.java
public class TurnTVOn implements Command {
Device device;
public TurnTVOn(Device device) {
this.device = device;
}
@Override
public void execute() {
View Command.java
public interface Command {
public void execute();
}
View Television.java
public class Television implements Device {
@Override
public void on() {
System.out.println("TV is on !!");
}
@Override
public void off() {
System.out.println("TV is off !!");
@anjanashankar9
anjanashankar9 / Device.java
Created Aug 1, 2021
Command Pattern - dev
View Device.java
public interface Device {
public void on();
public void off();
}
@anjanashankar9
anjanashankar9 / trust_policy.json
Created May 19, 2021
AWS - Role Based Access
View trust_policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}