This file contains 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
+--------------------+--------+---------------------------------------------------------+ | |
| column | type | description | | |
+--------------------+--------+---------------------------------------------------------+ | |
| id | int | Primary key | | |
+--------------------+--------+---------------------------------------------------------+ | |
| type | string | A type, can be used to group notifications | | |
+--------------------+--------+---------------------------------------------------------+ | |
| message | string | The message to send and display | | |
+--------------------+--------+---------------------------------------------------------+ | |
| created_at | Instant| Timestamp of the notification creation date | |
This file contains 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
+--------------------+--------+---------------------------------------------------------+ | |
| column | type | description | | |
+--------------------+--------+---------------------------------------------------------+ | |
| id | int | Primary key | | |
+--------------------+--------+---------------------------------------------------------+ | |
| notification_id | int | The id of the notification in the Notification table | | |
+--------------------+--------+---------------------------------------------------------+ | |
| user_id | string | The receiver user id | | |
+--------------------+--------+---------------------------------------------------------+ | |
| group_id | string | The receiver group id | |
This file contains 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
+----+--------+--------------+---------------------------+-----------+-------------+ | |
| id | type | message | created_at | is_active | business_id | | |
+----+--------+--------------+---------------------------+-----------+-------------+ | |
| 0 | "task" | "my message" | 2020-06-03T11:29:04+00:00 | true | "7" | | |
+----+--------+--------------+---------------------------+-----------+-------------+ |
This file contains 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
+----+-----------------+---------+----------+---------+ | |
| id | notification_id | user_id | group_id | is_read | | |
+----+-----------------+---------+----------+---------+ | |
| 0 | 0 | "user1" | null | 0 | | |
| 1 | 0 | "user2" | null | 0 | | |
| 2 | 0 | "user3" | null | 0 | | |
| 3 | 0 | null | "group1" | 0 | | |
| 4 | 0 | null | "group2" | 0 | | |
+----+-----------------+---------+----------+---------+ |
This file contains 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
@Override | |
public void notify(DelegateTask delegateTask) { | |
String taskId = delegateTask.getId(); // This is our business_id | |
// Only support 2 types of event for the time being. | |
switch (delegateTask.getEventName()) { | |
case TaskListener.EVENTNAME_CREATE: | |
// Extract the candidate users and groups. | |
Set<String>[] candidates = extractCandidates(delegateTask.getCandidates()); | |
// TODO send new notification to subscribers | |
break; |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am paulbares on github. | |
* I am paulbares (https://keybase.io/paulbares) on keybase. | |
* I have a public key ASBYPOCzlKPl7hi5H-UoSxTP1FJcYa6nuNA_o_J9uJ8idQo | |
To claim this, I am signing this object: |
This file contains 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
import java.nio.charset.Charset; | |
import java.util.UUID; | |
public class UUIDEncoder { | |
/** | |
* Use this charset because each character is encoded as a single eight-bit code value so a UUID can be represented | |
* with 16 characters. | |
*/ | |
private static final Charset CHARSET = Charset.forName("ISO-8859-1"); |
This file contains 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
const https = require('https'); | |
const fs = require('fs'); | |
const mimeTypes = { | |
"html": "text/html", | |
"jpeg": "image/jpeg", | |
"jpg": "image/jpeg", | |
"png": "image/png", | |
"svg": "image/svg+xml", | |
"json": "application/json", | |
"js": "text/javascript", |
This file contains 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
File file = new File(CsvGenerator.FILE_PATH); | |
Iterator<String> iterator = Files.lines(file.toPath()).iterator(); | |
AggregateResult result = new AggregateResult(); | |
while (iterator.hasNext()) { | |
String line = iterator.next(); | |
String[] values = line.split(","); | |
int year = Integer.parseInt(values[0]); | |
int mileage = Integer.parseInt(values[1]); | |
double price = Double.parseDouble(values[2]); |
This file contains 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
FileInputStream fileInputStream = new FileInputStream(CsvGenerator.FILE_PATH); | |
MyConsumer consumer = new MyConsumer(); | |
read(fileInputStream, consumer); | |
... | |
private static void read(FileInputStream fileInputStream, | |
Consumer consumer) throws IOException { | |
FileChannel fileChannel = fileInputStream.getChannel(); | |
ByteBuffer byteBuffer = ByteBuffer.allocate(capacity); |
OlderNewer