Skip to content

Instantly share code, notes, and snippets.

View radgeRayden's full-sized avatar
🤔

Westerbly Snaydley radgeRayden

🤔
View GitHub Profile
@radgeRayden
radgeRayden / gl.sc
Created October 1, 2020 01:32
Scopes GLFW/OpenGL example
# import C functions and sanitize the scope
vvv bind glad
do
let glad =
include
options
.. "-I" module-dir "/glad/include"
"glad/src/glad.c"
do
using glad.extern
sugar let (bindings body...)
let bindings =
fold (result = '(embed)) for binding in (bindings as list)
sugar-match (binding as list)
case (name expr)
cons
qq [let] [name] = [expr]
result
default
error "invalid let syntax"
@radgeRayden
radgeRayden / sc_cloc.sh
Last active October 1, 2020 16:59
Count lines of Scopes code in a directory
find . -name "*.sc" -print0 | xargs -0 -n 1 -I{} cat {} | pcregrep -Mv "^(?<pad> *)#.*\n( (?=\k<pad>).+\n)*" | pcregrep "^[ ]*.+?\$" | wc -l
#!/bin/fish
set -l MONTH (date +"%B")
set -l YEAR (date +"%Y")
set -l SSDIR "$HOME/Pictures/Screenshots/$YEAR-$MONTH"
mkdir -p $SSDIR
if test "$argv[1]" = "display"
if maim /tmp/screenshot.png
xclip -selection clipboard -t image/png -i /tmp/screenshot.png
set -l SSPATH $SSDIR/(date +%s)-(identify -format '%wx%h' /tmp/screenshot.png).png
inline gamma->linear (...)
va-map
inline (c)
if (c <= 0.04045)
c / 12.92
else
((c + 0.055) / 1.055) ** 2.4
...
inline tile@ (level width height p)
spice escape-pattern (str)
import UTF-8
using import itertools
str as:= string
let new-pattern =
->> str UTF-8.decoder
retain
inline (c)
switch c
using import glsl
using import glm
out out-color : vec4
location = 0
inline circle (pos uv radius)
let dist-test =
smoothstep
radius
@radgeRayden
radgeRayden / main.c
Last active May 9, 2020 02:50
triangle example with fullscreen
#ifndef WGPU_H
#define WGPU_H
#include "wgpu.h"
#endif
#include "framework.h"
#include <stdio.h>
#include <stdlib.h>
#define WGPU_TARGET_MACOS 1
@radgeRayden
radgeRayden / gl.sc
Last active October 1, 2020 02:32
sdl gl
# import C functions and sanitize the scope
vvv bind glad
do
let glad =
include
options
.. "-I" module-dir "/glad/include"
"glad/src/glad.c"
do
using glad.extern
let number-regexp =
do
hex-digit := "[0-9a-fA-F]"
bin-digit := "[01]"
oct-digit := "[0-7]"
fn re-or (...)
let result =
.. "("
va-lifold ""
inline (index _. value computed-result)