Skip to content

Instantly share code, notes, and snippets.

View dice_roller.jl
function roll(roll)
m=match(r"(?<number>\d*)[dD](?<sides>\d+)", roll)
m["number"] == "" ? number = 1 : number=parse(Int,m["number"])
sides=parse(Int,m["sides"])
roll_dice(number,sides)
end
function roll_dice(number::Integer,sides::Integer)
@jordancluts
jordancluts / CImGuiHelloWorld.jl
Created Sep 19, 2019
My MWE hello world using CImGui.jl
View CImGuiHelloWorld.jl
using CImGui
using CImGui.CSyntax
using CImGui.CSyntax.CStatic
using CImGui.GLFWBackend
using CImGui.OpenGLBackend
using CImGui.GLFWBackend.GLFW
using CImGui.OpenGLBackend.ModernGL
using Printf
@static if Sys.isapple()
View SubTypeTree.jl
function subtypetree(t, level=1, indent=4)
level == 1 && println(t)
for s in subtypes(t)
println(join(fill(" ", level * indent)) * string(s))
subtypetree(s, level+1, indent)
end
end
View FileDialog2.jl
#=
function formatstringold(filter::NTuple{N,String}) where N
string("|"*filter[1],"||".*filter[2:end]...)
end
=#
function formatfilterstring(filter::NTuple{N,Union{String,Tuple{String,String}}}) where N
outarray = String[]
for i in eachindex(filter)
if typeof(filter[i])==String
@jordancluts
jordancluts / gist:74981a9eeecb21e07fdf852ef297c87b
Created Jun 20, 2018
Self contained system style filepicker for Julia using QML.jl
View gist:74981a9eeecb21e07fdf852ef297c87b
module FileDialog
using QML
function filedialog(;title::String="File Dialog",foldermode::Bool=false,multiselect::Bool=false,filter::Array{String}=["All files (*)"],folder::String=pwd(),savemode::Bool=false)
qml_data = QByteArray("""
import QtQuick 2.2
import QtQuick.Dialogs 1.0
import QtQuick.Controls 1.0
import org.julialang 1.0
You can’t perform that action at this time.