This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.inf5190.chat; | |
| import java.util.Date; | |
| import java.util.List; | |
| import java.util.concurrent.ExecutionException; | |
| import org.springframework.web.bind.annotation.GetMapping; | |
| import org.springframework.web.bind.annotation.RestController; | |
| import com.google.api.core.ApiFuture; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Type avec union | |
| type Status = 'active' | 'inactive' | null | |
| // Définition d'interfaces | |
| interface User { | |
| name: string; // propriété et type | |
| age: number; | |
| status: Status; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (!actor) { | |
| ui.notifications.error('No token selected'); | |
| } | |
| async function show(roll) { | |
| if (game.modules.get("dice-so-nice") && | |
| game.modules.get("dice-so-nice").active) { | |
| await game.dice3d.showForRoll(roll, game.user, true); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://www.perdu.com/ | |
| const titre = document.getElementsByTagName('h1')[0]; | |
| titre.innerHTML = 'Toujours perdu?'; | |
| const texte = document.getElementsByTagName('h2')[0]; | |
| texte.insertAdjacentHTML("afterend", "<button id='aide'>Aidez moi!</button>"); | |
| const message = document.getElementsByTagName('pre')[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "coriolisNpcGenerator": { | |
| "settings": { | |
| "generateName": "Generate Name", | |
| "generateNameHint": "If enabled, a name will be generated for the NPC.", | |
| "generateProfession": "Generate Profession", | |
| "generateProfessionHint": "If enabled, a profession will be generated for the NPC.", | |
| "generateCharacteristic": "Generate Characteristic", | |
| "generateCharacteristicHint": "If enabled, a characteristic will be generated for the NPC.", | |
| "generateActivity": "Generate Activity", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object scrap { | |
| trait Value | |
| case class StringValue(value: String) extends Value | |
| case class LongValue(value: Long) extends Value | |
| val value: Value = StringValue("test") | |
| /**** Matching ****/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object CaseToList extends App { | |
| trait Collapsable { | |
| // OPTION 1 | |
| // Use reflection on the fields using the known public method of the property to access its value. | |
| // Can be incorrect if the case class defines attributes not to be added to the list. | |
| // Here I use the property name in the returned tuple list. | |
| def toCollapsedList1: Seq[Any] = { | |
| val list = for { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ** Ensure previous timestamp match last transaction event timestamp | |
| // before | |
| if (tx.previous != lastTimestamp) { | |
| throw new IOException("This transaction %s previous timestamp %s is not %s".format( | |
| tx, tx.previous, lastTimestamp)) | |
| } | |
| // after |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SalaryFunctions { | |
| private final float factor; | |
| public SalaryFunctions(float factor) { | |
| this.factor = factor; | |
| } | |
| public int computeBonus(Employee employee) { | |
| return Math.round(employee.salary * factor * employee.targetBonus); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SalaryFunctions { | |
| public int computeBonus(Employee employee, float factor) { | |
| return Math.round(employee.salary * factor * employee.targetBonus); | |
| } | |
| public int getWeeklySalary(Employee employee) { | |
| return Math.round(employee.salary / 52f); | |
| } | |
| } |