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 LanguageServer, StaticLint, SymbolServer | |
path = abspath(ARGS[1]) | |
root_file = if length(ARGS) > 1 | |
abspath(ARGS[2]) | |
else | |
joinpath(path, "src", string(basename(path), ".jl")) | |
end | |
s = LanguageServerInstance(Pipe(), stdout, path) |
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
Regex("""(?:[ | |
[:alpha:]_\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}\\p{Nl}\\p{Sc}\u2140-\u2144\u223f\u22be | |
\u22bf\u22a4\u22a5\u2202\u2205-\u2207\u220e\u220f\u2210\u2211\u221e\u221f\u222b-\u2233 | |
\u22c0-\u22c3\u25f8-\u25ff\u266f\u27d8\u27d9\u27c0\u27c1\u29b0-\u29b4\u2a00-\u2a06 | |
\u2a09-\u2a16\u2a1b\u2a1c\U1d6c1\U1d6db\U1d6fb\U1d715\U1d735\U1d74f\U1d76f\U1d789\U1d7a9 | |
\U1d7c3\u2071-\u207e\u2081-\u208e\u2220-\u2222\u299b-\u29af\u2118\u212e\u309b-\u309c | |
\U1d7ce-\U1d7e1 | |
]|[^\\P{So}\u2190-\u21FF]) | |
(?:[ | |
[:word:]_!\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}\\p{Nl}\\p{Sc}\u2140-\u2144\u223f\u22be |
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
# put this in your startup.jl | |
using InteractiveUtils | |
let | |
tmuxsession = nothing | |
sessions = split(String(read(`tmux list-panes -a -F '#{pane_tty} #{session_name}'`)), '\n') | |
io = IOBuffer() | |
run(pipeline(`tty`, stdout=io)) | |
tty = chomp(String(take!(io))) | |
for session in sessions | |
if occursin(tty, session) |
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 Printf | |
UNESCAPED = Set(codeunits("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.!~*'()")) | |
# https://tc39.es/ecma262/#sec-encodeuricomponent-uricomponent | |
function encode_uri_component(uri) | |
isvalid(uri) || throw(ArgumentError("`encode_uri_component` can only handle valid UTF8 strings.")) | |
io = IOBuffer() | |
for cp in codeunits(uri) |
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 | |
atreplinit() do repl | |
repl.interface = REPL.setup_interface(repl) | |
repl.interface.modes[1].on_enter = function (s) | |
mktemp() do path, io | |
input = chomp(String(take!(copy(LineEdit.buffer(s))))) | |
if isempty(input) | |
run(`nvim $(path)`) | |
sleep(0.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
module TraceCalls | |
using Cassette | |
mutable struct Trace | |
level::Int | |
cutoff::Int | |
end | |
Cassette.@context TraceCtx |
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
~ | |
λ mv ~/.julia/packages .julia/packages_old | |
~ | |
λ mkdir jenvtest | |
~ | |
λ cd jenvtest | |
~/jenvtest |
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> @enter wrapper() | |
In wrapper() at /home/pfitzseb/.julia/dev/Atom/test.jl:2 | |
1 function wrapper() | |
>2 mktempdir() do dir | |
3 open(joinpath(dir, "test.txt"), "w") do io | |
4 println(io, "data") | |
5 end | |
6 end | |
7 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
using Dates | |
period(::Dates.DatePart{T}, val) where T = Dates.CONVERSION_SPECIFIERS[T](val) | |
period(::Dates.Delim, val) = Millisecond(0) | |
Base.parse(t::Type{TimePeriod}, str::AbstractString, df::AbstractString) = parse(t, str, DateFormat(df)) | |
function Base.parse(t::Type{TimePeriod}, str::AbstractString, df::DateFormat) | |
out = Millisecond(0) | |
len = length(str) | |
i = 1 |
NewerOlder