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
using Dates: DateTime, issaturday, issunday, now, tonext, Hour, hour, Minute | |
isweekend(dt::DateTime) = issaturday(dt) || issunday(dt) | |
# Step from now on by 1 hour lapses until the next coffee time is found. | |
next_coffee_t = tonext(floor(now(),Hour), step=Hour(1)) do dt | |
!isweekend(dt) && # We do not work at the office on weekends. | |
(hour(dt) == 13 || # After lunch, or | |
hour(dt) == 17) # in the evening. |
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
# # One-liners | |
low, high = minmax(4,3) | |
low, high = extrema([1,3,5,7]) | |
# double factorial | |
dfactorial(n::Int) = prod(n:-2:1) | |
# Non equivalent pairs | |
_pairs(n::Int) = ((i,j) for i in 1:n for j in 1:(i-1)) # upper triangle without diagonal | |
_pairs_wself(n::Int) = ((i,j) for i in 1:n for j in 1:i) # upper triangle with diagonal |
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
# Run Julia files from the REPL with the following syntax: | |
# > @run "../file.jl" <-- String (any rel/abs path) [si autocompletion] | |
# > @run file.jl <-- Expr (no ./ or ../ etc) [no autocompletion] | |
# > @run file <-- Symbol (no ./ or ../ etc) [no autocompletion] | |
macro run(filename) | |
if filename isa String | |
include(filename) | |
elseif filename isa Expr | |
include(join([string(filename.args[1]), | |
string(filename.args[2].value)], |
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 quickstart_dense.cc | |
* | |
* @section LICENSE | |
* | |
* The MIT License | |
* | |
* @copyright Copyright (c) 2018 TileDB, Inc. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy |