Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jordancluts
jordancluts / gist:74981a9eeecb21e07fdf852ef297c87b
Created June 20, 2018 18:11
Self contained system style filepicker for Julia using QML.jl
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
function formatfilterstring(filter::NTuple{N,Union{String,Tuple{String,String}}}) where N
outarray = String[]
for i in eachindex(filter)
if typeof(filter[i])==String
push!(outarray,"",filter[i])
else
push!(outarray,filter[i]...)
end
end
string(outarray[1],"|" .* outarray[2:end]...)
@jordancluts
jordancluts / SubTypeTree.jl
Created February 15, 2019 14:16
Julia Type Tree
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
@jordancluts
jordancluts / CImGuiHelloWorld.jl
Created September 19, 2019 14:41
My MWE hello world using CImGui.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()
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 / Fiji.json
Last active August 31, 2021 18:22
Development App Manifest for Scoop Extras
{
"version":"2.1.0_1.53c",
"description": "Fiji is an image processing package — a \"batteries-included\" distribution of ImageJ, bundling many plugins which facilitate scientific image analysis. ",
"homepage":"https://fiji.sc/",
"license":{
"identifier":"GPL-3.0-only",
"url":"https://github.com/fiji/fiji/blob/master/LICENSE.txt"
},
"architecture": {
"64bit":{
abstract type Operation end
struct Acc <: Operation
value::Int
end
struct Jmp <: Operation
value::Int
end
### A Pluto.jl notebook ###
function parse_line(line)
patterns, values = split.(split(line," | "),' ')
return collect.(patterns),collect.(values)
end
function Part1(file)
total = 0
uniques = Set([2,3,4,7])