Skip to content

Instantly share code, notes, and snippets.

View simsaens's full-sized avatar

Sim Saëns simsaens

  • Two Lives Left
  • Adelaide, Australia
View GitHub Profile
/* global exports:true, module:true, require:true, define:true, global:true */
(function (root, name, factory) {
'use strict';
// Used to determine if values are of the language type `Object`
var objectTypes = {
'function': true
, 'object': true
}
@simsaens
simsaens / JAMLuaTokenizer.swift
Created April 9, 2024 12:31
Codea's Lua UITextInputTokenizer
//
// JAMLuaTokenizer.swift
// JamKit
//
// Created by Sim Saens on 7/4/2024.
// Copyright © 2024 Two Lives Left. All rights reserved.
//
import UIKit
-- Dungeon variables
local dungeonWidth = 16 -- The width of the dungeon in tiles
local dungeonHeight = 16 -- The height of the dungeon in tiles
local tileSize = 40 -- The size of each tile in pixels
local dungeon = {} -- The dungeon map
local rooms = {} -- The list of rooms in the dungeon
local doors = {} -- The list of doors in the dungeon
local traps = {} -- The list of traps in the dungeon
-- Colors
@simsaens
simsaens / SKPayment+Async.swift
Created December 20, 2021 05:39
These three files extend the default StoreKit API to use async in Swift 5.5. Based on the PromiseKit StoreKit extensions
//
// SKPayment+Async.swift
//
// Created by Sim Saens on 15/12/21.
//
import Foundation
import StoreKit
//Adds an async extension to SKPayment to purchase products
@simsaens
simsaens / InstancedSnow.lua
Created April 28, 2021 06:04
Codea project which uses mesh instancing to draw snow
--# Main
-- 3D Snow
function setup()
viewer.mode = FULLSCREEN
parameter.watch("FPS")
parameter.boolean("camOrtho", false)
parameter.number("timeSpeed", 0, 8, 1)
parameter.number("hspread", 0, 50, 50)
@simsaens
simsaens / Main.lua
Last active March 22, 2020 00:08
Updated 3D Asset Viewer #2
-----------------------------------------
-- Models
-- Written by John Millard
-----------------------------------------
-- Description:
-- Domonstrates model loading in Craft.
-----------------------------------------
Tag = class()
@simsaens
simsaens / Main.lua
Created March 21, 2020 23:49
Updated 3D Asset Viewer
-----------------------------------------
-- Models
-- Written by John Millard
-----------------------------------------
-- Description:
-- Domonstrates model loading in Craft.
-----------------------------------------
Tag = class()
@simsaens
simsaens / CodeEditor.m
Created August 30, 2019 04:13
Responding to copy and paste
- (BOOL) canPerformAction:(SEL)action withSender:(id)sender
{
switch ( menuState )
{
case JAMCodeEditorMenuStateHidden:
{
if( self.selectedRange.length == 0 )
{
if( action == @selector(select:) ||
action == @selector(selectAll:) ||
@simsaens
simsaens / Header.swift
Created February 15, 2019 08:42
Add these two overrides to class Header
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
guard let menu = menuView else {
return super.point(inside: point, with: event)
}
let menuPoint = convert(point, to: menu)
if menu.point(inside: menuPoint, with: event) {
return true
}
@simsaens
simsaens / main.lua
Last active January 25, 2019 14:17
backingMode(RETAINED)
function setup()
background(0)
stroke(255)
strokeWidth(5)
fill(227, 106, 106, 255)
ellipse(WIDTH/2, HEIGHT/2, 500)
end