Skip to content

Instantly share code, notes, and snippets.

@cormullion
cormullion / julia-gender-inclusive.jl
Last active July 4, 2024 07:45
Julia Gender Inclusive
using Luxor, Colors
function umbrella(pos;
colors = Colors.JULIA_LOGO_COLORS,
scalefactor = 1)
pink = parse(Colorant, "#FFAFC8")
lblue = parse(Colorant, "#74D7EE")
brown = parse(Colorant, "#613915")
@layer begin
@cormullion
cormullion / maps.jl
Created March 20, 2024 17:23
a map icon
using Thebes
using Luxor
using Rotations
using Colors
julia_colors = [Luxor.julia_red,
Luxor.julia_purple,
Luxor.julia_blue,
Luxor.julia_green
]
@cormullion
cormullion / rectangular-moon-card.jl
Created January 9, 2024 09:08
rectangular moon calendar
using Colors, Luxor, Dates, JSON, DataFrames, Downloads
theyear = 2024
data_url = "https://svs.gsfc.nasa.gov/vis/a000000/a005100/a005187/mooninfo_2024.json"
if !isfile(string(@__DIR__, "/nasa-moon-$(theyear)-data.json"))
Downloads.download(data_url, "nasa-moon-2024-data.json")
end
function getdata()
@cormullion
cormullion / tape.jl
Last active December 13, 2023 12:14
rotating tape spools
using Luxor, Colors
function drawtape(spoolradius, separation, e)
@layer begin
# draw the 'tape' threading between the spools
# (e is normalized 0 to 1 for animation)
sr = spoolradius + 10 # outside spool, not realistic
spoolcenters = ngon(O, separation, 3, vertices = true)
top_point = Point(spoolcenters[2].x, spoolcenters[2].y - spoolradius - 10)
# top left spool
@cormullion
cormullion / tidiertext-logo.jl
Last active November 28, 2023 10:11
a logo idea
using Luxor, Colors
# julia colors as extracted from the SVG
tidier_lighter_colors = [
RGB(202 / 256, 60 / 256, 50 / 256), # lighter red
RGB(57 / 256, 151 / 256, 70 / 256), # lighter green
RGB(146 / 256, 89 / 256, 163 / 256), # lighter purple
RGB(76 / 256, 100 / 256, 176 / 256), # lighter blue
]
@cormullion
cormullion / propeller-check.jl
Created July 16, 2023 16:14
a propeller icon
using Luxor, Colors
function blade(θ, n)
@layer begin
rotate(θ)
move(Point(46, 3.693))
curve(Point(147.98, -101.378), Point(366.389, 35.292), Point(240, 145))
curve(Point(43, 316), Point(107, 16), Point(46, 3.693))
sethue(Colors.JULIA_LOGO_COLORS[mod1(n - 1, end)])
fillpath()
@cormullion
cormullion / animation-sketch.jl
Created June 6, 2023 14:37
an animated something
using Luxor, Thebes, MathTeXEngine
function frame(scene, framenumber)
background("white")
sethue("black")
fontsize(15)
eased_n = scene.easingfunction(framenumber, 0, 1, scene.framerange.stop)
helloworld()
eyepoint(200, 200, 100)
setline(0.5)
@cormullion
cormullion / data.txt
Created October 1, 2022 15:59
ColorSchemes.jl loading after adding ColorVectorSpace dependency
For version 3.17:
```
julia> @time_imports using ColorSchemes
72.0 ms FixedPointNumbers
0.2 ms Reexport
75.7 ms ColorTypes 7.36% compilation time
223.3 ms Colors
12.5 ms ColorSchemes
```
@cormullion
cormullion / huh.jl
Created September 6, 2022 09:44
julia users helsinki
using Luxor
helsinkilogo = Path([
PathMove(Point(4.245, 57.972)),
PathCurve(Point(9.725, 52.512), Point(17.013, 49.505), Point(24.763, 49.505)),
PathLine(Point(102.34, 49.505)),
PathCurve(Point(120.348, 49.505), Point(135, 35.014), Point(135, 17.203)),
PathLine(Point(135, -61.799)),
PathLine(Point(-134.588, -61.799)),
PathLine(Point(-134.588, 17.203)),
@cormullion
cormullion / paintingboxes.jl
Created February 10, 2022 16:50
painting boxes
using Colors, Images, Luxor, Statistics
# tile of an image
struct ImageTile
image::Array
imagewidth::Real
imageheight::Real
tilewidth::Real
tileheight::Real
centerpos::Point