Skip to content

Instantly share code, notes, and snippets.

@mbauman
Last active August 29, 2015 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbauman/f9d6c8ac0e402de895ed to your computer and use it in GitHub Desktop.
Save mbauman/f9d6c8ac0e402de895ed to your computer and use it in GitHub Desktop.
juliarc
module RC
## Method sorting: https://github.com/JuliaLang/julia/pull/6119 (closed wontfix)
Base.isless(a::Method, b::Method) = isless(a.func.code.name, b.func.code.name)
## Simplify life when calling methodswith. I always do it wrong.
Base.methodswith(x, showparents::Bool=false) = methodswith(typeof(x), showparents)
if VERSION < v"0.3-"
ENV["JULIA_HISTORY"] = joinpath(homedir(), "~/.julia_history_v0.2")
elseif isinteractive()
## Swanky inline terminal graphs - WHY CAN'T I IMPORT HERE?
require("TerminalExtensions.jl")
function update_plot_size()
height, width = Base.tty_size()
height = min(height-1, 2/3*width)
# Convert to pixels, using font metrics for 13pt Consolas in iTerm2
width *= 7.0 # or Monaco 12pt metrics: 7.125
height *= 16.0 # 17.2
isdefined(Main, :Gadfly) && Main.Gadfly.set_default_plot_size(width * Main.Gadfly.px, height * Main.Gadfly.px)
isdefined(Main, :Winston) && Main.Winston.set_default_plot_size(ifloor(width), ifloor(height))
nothing
end
if isdefined(Main, :Gadfly) && isdefined(Main, :Color)
iTerm2 = Main.TerminalExtensions.iTerm2
Gadfly = Main.Gadfly
color = Main.Color.color
update_plot_size()
Gadfly.set_default_plot_format(:png)
const repl_theme = Gadfly.Theme(panel_fill = color("black"),
default_color = color("orange"),
major_label_color = color("white"),
minor_label_color = color("white"),
key_label_color = color("white"),
key_title_color = color("white"))
for mime in iTerm2.iterm2_mimes
@eval function Base.display(d::iTerm2.InlineDisplay, m::MIME{symbol($mime)}, p::Gadfly.Plot)
theme = p.theme
p.theme = repl_theme
invoke(display,(typeof(d),typeof(m),Any),d,m,p)
p.theme = theme
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment