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
julia> function async_eval(code) | |
sleep(2) | |
# hide prompt | |
print(stdout, "\e[1K\r") | |
# write code | |
printstyled(stdout, "julia> ", bold = true, color=:green) | |
print(stdout, code) | |
# eval code | |
println(stdout) |
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
# paste into your coffee.init | |
atom.commands.add 'atom-text-editor', 'Toggle #\'', (e) => | |
ed = atom.workspace.getActiveTextEditor() | |
sels = ed.getSelections() | |
buffer = ed.getBuffer() | |
lines = buffer.getLines() | |
for sel in sels | |
isOn = true | |
preIndents = [] |
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
module MockPlotting | |
struct SimplePlot end | |
struct InteractivePlot end | |
const img = """ | |
/9j/2wCEAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDIBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAY8BkAMBIgACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AOuBpQeaYDTs1BY8GlzTAaXNAxwPvS5pgNOzQA+jNMz70v40CuOFITg0ZphPNMBwb86cDUY5NPHSkAuaKSlpjsKBSEYpaCKBDT0ptPNNNIY09KaadSGgBppppSKaaBid6UGm0tADwaBTRS5oAcDzSi |
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
Revise.Diff('+', (Markdown, :(#5#f = begin | |
function hashheader(stream::IO, md::MD) | |
withstream(stream) do | |
eatindent(stream) || return false | |
level = 0 | |
while startswith(stream, '#') | |
level += 1 | |
end | |
(level < 1 || level > 6) && return false | |
c = ' ' |
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
julia> logs = filter(r->r.level==Debug && r._module==Revise, rlogger.logs); | |
julia> logs | |
1357-element Array{Test.LogRecord,1}: | |
Test.LogRecord(Debug, "Recipe for Base", Revise, "Watching", :Revise_61343d83, "C:\\Users\\Basti\\.julia\\dev\\Revise\\src\\recipes.jl", 25, Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:filename, :mtime, :mtimeref),Tuple{String,Float64,Float64}}}(:filename=>"D:\\Programme\\Julia-1.0.0\\share\\julia\\base\\traits.jl",:mtime=>1.53377e9,:mtimeref=>1.53377e9)) | |
Test.LogRecord(Debug, "Recipe for Base", Revise, "Watching", :Revise_61343d84, "C:\\Users\\Basti\\.julia\\dev\\Revise\\src\\recipes.jl", 25, Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:filename, :mtime, :mtimeref),Tuple{String,Float64,Float64}}}(:filename=>"D:\\Programme\\Julia-1.0.0\\share\\julia\\base\\array.jl",:mtime=>1.53469e9,:mtimeref=>1.53377e9)) | |
Test.LogRecord(Debug, "Recipe for Base", Revise, "Watching", :Revise_61343d85, "C:\\Users\\Basti\\.julia\\dev\\Revise\\sr |
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
julia> filter(r->r.level==Base.CoreLogging.Debug && r._module==Revise, rlogger.logs) | |
522-element Array{Test.LogRecord,1}: | |
Test.LogRecord(Debug, "Recipe for Base", Revise, "Watching", :Revise_61343d83, "C:\\Users\\Basti\\.julia\\dev\\Revise\\src\\recipes.jl", 25, Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:filename, :mtime, :mtimeref),Tuple{String,Float64,Float64}}}(:filename=>"D:\\Programme\\Julia-1.0.0\\share\\julia\\base\\traits.jl",:mtime=>1.53377e9,:mtimeref=>1.53377e9)) | |
Test.LogRecord(Debug, "Recipe for Base", Revise, "Watching", :Revise_61343d84, "C:\\Users\\Basti\\.julia\\dev\\Revise\\src\\recipes.jl", 25, Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:filename, :mtime, :mtimeref),Tuple{String,Float64,Float64}}}(:filename=>"D:\\Programme\\Julia-1.0.0\\share\\julia\\base\\array.jl",:mtime=>1.53469e9,:mtimeref=>1.53377e9)) | |
Test.LogRecord(Debug, "Recipe for Base", Revise, "Watching", :Revise_61343d85, "C:\\Users\\Basti\\.julia\\dev\\Revise\\src\\re |
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
julia> f = filter(r->r.message=="Diff" && (!isempty(r.kwargs[:newexprs]) || !isempty(r.kwargs[:oldexprs])), rlogger.logs); | |
julia> for i in f | |
println(f) | |
end | |
Test.LogRecord[LogRecord(Debug, "Diff", Revise, "Parsing", :Revise_67b60225, "C:\\Users\\Basti\\.julia\\dev\\Revise\\src\\Revise.jl", 212, Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:activemodule, :newexprs, :oldexprs),Tuple{Module,Set{Revise.RelocatableExpr},Set{Revise.RelocatableExpr}}}}(:activemodule=>LibGit2,:newexprs=>Set(Revise.RelocatableExpr[:(function clone(repo_url::AbstractString, repo_path::AbstractString; branch::AbstractString="", isbare::Bool=false, remote_cb::Ptr{Cvoid}=C_NULL, credentials::Creds=nothing, callbacks::Callbacks=Callbacks()) | |
cred_payload = reset!(CredentialPayload(credentials)) | |
if !(haskey(callbacks, :credentials)) | |
callbacks[:credentials] = (credentials_cb(), cred_payload) | |
elseif haskey(callbacks, :credentials) && credentials !== nothing |
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
julia> tryprint.(f[1].kwargs[:oldexprs]) | |
call | |
Base.Docs.doc! | |
Libdl | |
call | |
Base.Docs.Binding | |
Libdl | |
:RTLD_NODELETE | |
call |
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 REPL | |
using REPL.LineEdit | |
# basically the same as Base's `display_error`, just with different frames removed | |
function display_error(io, err, st) | |
ind = findfirst(frame -> frame.file == Symbol(@__FILE__) && frame.func == :repleval, st) | |
st = st[1:(ind == nothing ? end : ind - 2)] | |
printstyled(io, "ERROR: "; bold=true, color=Base.error_color()) | |
showerror(IOContext(io, :limit => true), err, st) | |
println(io) | |
end |
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
[[Base64]] | |
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" | |
[[CSTParser]] | |
deps = ["LibGit2", "Test", "Tokenize"] | |
git-tree-sha1 = "fac55d11171228b7101948abde613e769b9277d6" | |
repo-rev = "master" | |
repo-url = "https://github.com/ZacLN/CSTParser.jl.git" | |
uuid = "00ebfdb7-1f24-5e51-bd34-a7502290713f" | |
version = "0.5.0+" |