I have a class hierarchy in which every class has some defined properties.
I want to use builder pattern for all of these classes. Since the classes
are set up in a hierachy, ideally I would do the same with the builders.
The build
function can validate its parts before constructing the concrete
object. This guarantees that all necessary invariants are met.
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
input() = """22243 | |
11899 | |
1696 | |
2595 | |
5331 | |
6092 | |
5274 | |
5641 | |
1345 |
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
Warning: Sending message failed | |
β exception = | |
β IOError(EOFError() during request(https://discord.com/api/v10/channels/997765767053459520/messages)) | |
β | |
β Stacktrace: | |
β [1] read_to_buffer(t::HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}, sizehint::Int64) | |
β @ HTTP.ConnectionPool ~/.julia/packages/HTTP/aTjcj/src/ConnectionPool.jl:275 | |
β [2] readuntil(t::HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}, f::Function, sizehint::Int64) | |
β @ HTTP.ConnectionPool ~/.julia/packages/HTTP/aTjcj/src/ConnectionPool.jl:294 | |
β [3] readuntil |
The following are valid timezones that can be used for JuliaCon bot's jc command.
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Define a function such that it only executes its body once. The value from first execution is memoized at the module level.
module X
export once
let x = Ref{Any}()
global function once(f::Function)
isassigned(x) && return x[]
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
function stream_user_input(c::Channel) | |
while true | |
line = readline() | |
if line == "" | |
put!(c, ">>bye") | |
break | |
else | |
put!(c, line) | |
end | |
end |
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
Hi SciML attendees, | |
We will use Discord as the primary chat platform during the conference. | |
The Humans of Julia community already has a server, so we will leverage the same server | |
and use a dedicated channel there (#scimlcon) for the SciML conference. | |
Please click on the link below to join the server: | |
https://discord.gg/PRqc3NehEr | |
For more information about the Discord platform, please visit their web site at https://discord.com/ |
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
HoJBot lost connection to Discord | |
β Info: Reconnecting | |
β time = 2022-02-24T04:58:52.571 | |
β conn = 29 | |
β resume = true | |
β zombie = true | |
β Error: Getting gateway URL failed | |
β time = 2022-02-24T04:59:51.869 | |
β exception = |
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
# Modified from @frank's code at Discord | |
function koch_curve!(X, Y, x1, y1, x2, y2, level) | |
if level == 0 | |
push!(X, x1) | |
push!(X, x2) | |
push!(Y, y1) | |
push!(Y, y2) | |
else | |
Ξx = x2 - x1 |
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
using BenchmarkTools | |
function apply_filter_jl(E, wx) | |
Xest = 0.0 + 0.0im | |
@inbounds for j = 1:size(E, 2) | |
for i = 1:size(E, 1) | |
Xest += E[i, j] * wx[i, j]' | |
end | |
end | |
return Xest |
NewerOlder