All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Register

Login


All New Register Login

All gists

Recently created
Least recently created
Recently updated
Least recently updated
capitalex's Avatar

capitalex / tree.lua

0 likes
0 forks
1 files
Last active 1 month ago
1 local function table_stream(t)
2 return coroutine.wrap(function()
3 for _, v in ipairs(t) do
4 coroutine.yield(v)
5 end
6 end)
7 end
8
9 local function push(t, v)
10 table.insert(t, v)
capitalex's Avatar

capitalex / ewe.stackops.wul

0 likes
0 forks
2 files
Last active 1 month ago
1 @ewe @ewe.pop ; @ewe.stack $name {
2 @ewe pop $name
3 }
4
5 @ewe @ewe.push ; @ewe.stack $name {
6 @ewe push $name
7 }
8
9 @ewe @ewe.peek ; @ewe.stack $name {
10 @ewe peek $name
capitalex's Avatar

capitalex / sparse_set.lua

0 likes
0 forks
1 files
Last active 1 month ago
1 local function push(self, thing)
2 -- Attempt to recycle a previously freed ID
3 local id = self.free_ids[#self.free_ids]
4 table.remove(self.free_ids)
5 if not id then
6 -- Othewise generate a new ID
7 id = self.next_id
8 self.next_id = self.next_id + 1
9 end
10 -- Assign the ID, the push the object into items
capitalex's Avatar

capitalex / tictactoe.io

0 likes
0 forks
1 files
Last active 1 month ago
1 Cell := Object clone do (
2 state := nil
3 occupy := method(player,
4 state = player
5 )
6 empty := method(state isNil)
7 asString := method(
8 if(state isNil, return "_")
9 state
10 )
capitalex's Avatar

capitalex / tak.nv

0 likes
0 forks
1 files
Last active 1 month ago
1 ||
2 :: tak 7 4 8
3 :: print return
4
5 |:: tak $x $y $z |
6 :: check if $y less than $x
7 :: if Yes then recurse tak $x $y $z
8 :: if Nah then return $z
9
10 |:: check if $x $want than $y :@math: $want| :vote: Yes
capitalex's Avatar

capitalex / main.wul

0 likes
0 forks
2 files
Last active 1 month ago
1 { @code [
2 local objects = {}
3 local id = 0
4 ] }
5
6 { @ initialize LOVE event handlers
7 , spawn 1000 circles
8 }
9
june's Avatar

june / A formatting print rule-set.

0 likes
0 forks
1 files
Last active 1 month ago
Supports custom formatting by adding additional rules. (Runs in Serpens.)
1 |:: print? :string: '%d'| :: print a number
2 |:: print? :string: '%b'| :: print a number :base: 2
3 |:: print? :string: '%x'| :: print a number :base: 16
4 |:: print? :string: '%s'| :: print a string
5 |:: print? :string: '{}'| :: print an argument
6 |:: print? :string: '\n'| :string: 10
7 |:: print? :string: '\t'| :string: 9
8 |:: print? :string: '\r'| :string: 13
9 |:: print? :string: '\0'| :string: 0
10 |:: print? :string: $ | :@stdio: write $
june's Avatar

june / A simple search algorithm.

0 likes
0 forks
1 files
Last active 1 month ago
It eats whatever you pass into it.
1 |:search for: $something :collection: $something|
2 :found: $something
3 |:search for: $something :collection: $something-else|
4 :search for: $something
5 |:search for: $something|
6 :not found: $something
7
8 ||:search for: red
9 :collection: (green blue white orange red violet)
capitalex's Avatar

capitalex / main.processor.wul

0 likes
0 forks
4 files
Last active 1 month ago
1 {
2 @ make player at 100 100
3 , move player by 20 50
4 , @lamb pprint
5 }
6
7 @processor @ ;
8 @ move player by $x $y {
9 @processor @ ; @process switch to @ewe ;
10 @ewe ( #player @ewe.peek move by $x $y 4 @lamb.invoke @ewe.done ) ;
capitalex's Avatar

capitalex / main.wul

0 likes
0 forks
3 files
Last active 1 month ago
1 {
2 @ make player at 100 100
3 , move player by 20 50
4 , @lamb pprint
5 }
6
7 @ move player by $x $y {
8 @ewe ( #player @ewe.peek move by $x $y 4 @lamb.invoke ) ;
9 }
Newer Older

Powered by Opengist ⋅ Load: 168ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文