Skip to content

Instantly share code, notes, and snippets.

View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<script type="text/javascript">
function notify() {
new Notification("通知");
}
</script>
View main.js
const Store = require('electron-store')
const store = new Store()
function createWindow () {
const win = new BrowserWindow({
width: store.get('width',800), // 永続化されていたらその値を、されていなければデフォルト値
height: store.get('height',600), // 永続化されていたらその値を、されていなければデフォルト値
center: true,
resizable: true,
webPreferences: {
nodeIntegration: true,
View package.json
{
"name": "create-app",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"keywords": [],
"author": "",
View DecoratorSample.java
package jp.co.confrage.decorator;
public class DecoratorSample {
public static void main(String[] args) {
Coffee coffee = new Coffee();
coffee = new Milk(coffee); // ラップ
System.out.println(coffee.price()); // 360
View Milk.java
package jp.co.confrage.decorator;
public class Milk extends Decorator {
public Milk(Coffee coffee) {
super(coffee);
}
@Override
public int price() {
View Decorator.java
package jp.co.confrage.decorator;
public abstract class Decorator extends Coffee {
protected Coffee coffee;
public Decorator(Coffee coffee) {
this.coffee = coffee;
}
public abstract int price();
View Coffee.java
package jp.co.confrage.decorator;
public class Coffee {
public int price() {
return 350;
}
}
View TemplateSample.java
package jp.co.confrage.template;
import java.util.stream.Stream;
public class TemplateSample {
public static void main(String[] args) {
Human[] human = {new American("こんにちは", "さようなら"), new Japanese("Hello", "Bye")};
Stream.of(human)
View American.java
package jp.co.confrage.template;
public class American extends Human {
public American(String sayMessage, String byeMessage) {
super(sayMessage, byeMessage);
}
@Override
public void handShake() {
System.out.println("handShake");
View Japanese.java
package jp.co.confrage.template;
public class Japanese extends Human {
public Japanese(String sayMessage, String byeMessage) {
super(sayMessage, byeMessage);
}
@Override
public void handShake() {