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
#!/bin/bash | |
# Check if the correct number of arguments is provided | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 <system> <url>" | |
exit 1 | |
fi | |
# Assign command line arguments to variables | |
url="$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
data class GivenContext<T>(val given: T) | |
data class WhenContext<G, W>(val given: G, val outcome: W) | |
private fun <T> given(block: () -> T): GivenContext<T> = GivenContext(block()) | |
private fun <T, W> GivenContext<T>.whenn(block: GivenContext<T>.() -> W): WhenContext<T, W> = | |
WhenContext(given, block()) | |
private fun <T, W> WhenContext<T, W>.then(block: WhenContext<T, W>.(outcome: W) -> Unit) { | |
block(this.outcome) | |
} |
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
version: '3.8' | |
services: | |
graph-notebook: | |
image: public.ecr.aws/neptune/graph-notebook:3.9.0 | |
ports: | |
- "8889:8889" | |
- "8888:8888" | |
environment: | |
- GRAPH_NOTEBOOK_HOST=gremlin-server | |
- GRAPH_NOTEBOOK_SSL=False |
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 { PDFDocument } from 'pdf-lib' | |
import { promises as fsp } from "fs" | |
function readPdf(path) { | |
return fsp.readFile(path) | |
} | |
// only works on a sorted array by bage | |
function findSongFinalPage(array, currentIndex) { | |
const currentSong = array[currentIndex] |
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
// made to be used at: https://www.prullenbakvaccin.nl/ | |
let jobResources = { | |
streetAndNumberRegex: /([A-Z])\w+ ([0-9])\w+,/, | |
cityAndZipCodeRegex: /\d{4}([A-Z]){2} ([A-Z])\w+/ | |
} | |
async function notify(text) { | |
if(Notification.permission === "granted") { | |
let notification = new Notification('New vaccination location available', { |
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
// 1 - access https://github.com/settings/tokens | |
// 2 - create a personal access token, giving it permissions: repo, read:org, read:user | |
// 3 - paste the token in the constant below | |
// 4 - put the user name that you want to find | |
// 5 - put the organization in which the script will look-up for commits/additions/deletions | |
// 6 - script is compatible with Chrome, as it uses the fetch API | |
let token = '[PASTE-TOKEN-HERE]' | |
let username = '[PUT-YOUR-USERNAMEHERE]' | |
let organization = '[PUT-YOUR-ORGANAZATION-ID-HERE]' |
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
public class Order | |
{ | |
private Order() { } | |
public string OrderId { get; private set; } | |
public string CustomerId { get; private set; } | |
public decimal Discount { get; private set; } | |
public bool Paid { get; private set; } | |
public DateTime? PaymentTime { get; private set; } | |
public DateTime CreationTime { get; private set; } |
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
private List<OrderItem> _items; // The original source is private and can only be modified by this class. | |
public IEnumerable<OrderItem> Items => _items.AsReadOnly(); // Exposes a readonly copy of order items |
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
public class OrderItem | |
{ | |
private OrderItem() { } | |
public static OrderItem New(string productId, int quantity, decimal price, decimal discount = 0) | |
{ | |
if (string.IsNullOrWhiteSpace(productId)) throw new ArgumentNullException(nameof(productId)); | |
if (quantity <= 0) throw new ArgumentOutOfRangeException(nameof(quantity)); | |
if (price <= 0) throw new ArgumentOutOfRangeException(nameof(price)); | |
if (discount < 0) throw new ArgumentOutOfRangeException(nameof(discount)); |
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
public static Order New(string orderId, string customerId, DateTime? creationTime = null) | |
{ | |
if (string.IsNullOrWhiteSpace(orderId)) throw new ArgumentNullException(nameof(orderId)); | |
if (string.IsNullOrWhiteSpace(customerId)) throw new ArgumentNullException(nameof(customerId)); | |
return new Order | |
{ | |
OrderId = orderId, | |
CustomerId = customerId, | |
CreationTime = creationTime ?? DateTime.UtcNow, |
NewerOlder