Skip to content

Instantly share code, notes, and snippets.

View SquidDev's full-sized avatar
🦑
Under the sea

Jonathan Coates SquidDev

🦑
Under the sea
View GitHub Profile
-----------------------------------------------------------------------------
Info file generated by Happy Version 1.19.9 from src/Parser.y
-----------------------------------------------------------------------------
state 53 contains 7 shift/reduce conflicts.
terminal '[' is unused
terminal ']' is unused
-----------------------------------------------------------------------------
@SquidDev
SquidDev / clone.lua
Last active August 18, 2022 05:38
A tiny git clone library
local preload = type(package) == "table" and type(package.preload) == "table" and package.preload or {}
local require = require
if type(require) ~= "function" then
local loading = {}
local loaded = {}
require = function(name)
local result = loaded[name]
if result ~= nil then
--- Port of https://github.com/forrestthewoods/lib_fts/blob/master/code/fts_fuzzy_match.js
-- to Lua
--- Check if ptrn is found sequentially within str
local function matchSimple(str, ptrn)
local ptrnCtr, strCtr = 1, 1
local ptrnLen, strLen = #ptrn, #str
while ptrnCtr <= ptrnLen and strCtr <= strLen do
local ptrnChar = ptrn:sub(ptrnCtr, ptrnCtr):lower()
local loading = {}
local oldRequire, preload, loaded = require, {}, { startup = loading }
local function require(name)
local result = loaded[name]
if result ~= nil then
if result == loading then
error("loop or previous error loading module '" .. name .. "'", 2)
end
--[[
The MIT License (MIT)
Copyright (c) 2015-2016 SquidDev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
local loading = {}
local oldRequire, preload, loaded = require, {}, { startup = loading }
local function require(name)
local result = loaded[name]
if result ~= nil then
if result == loading then
error("loop or previous error loading module '" .. name .. "'", 2)
end
@SquidDev
SquidDev / CCTweaks-Versions.json
Created December 27, 2015 19:18
CCTweaks-Versions
{
"homepage": "https://github.com/SquidDev-CC/CC-Tweaks",
"promos": {
"1.7.10-latest": "0.2.3.4",
"1.7.10-recommended": "0.2.3.4",
"1.8-latest": "0.2.3.4",
"1.8-recommended": "0.2.3.4"
},
"1.7.10": {
"0.2.3.4": "Computronics Multiperipheral Compatability\nUpdate Patcher version fixing issue with `peripheral.getMethods.`"
* {
animation-name: example;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
/* Standard syntax */
@keyframes example {
0% {transform:rotate(0deg)}
@SquidDev
SquidDev / bin-example.lua
Created July 23, 2015 14:58
Parsel Operators
local parsel = setmetatable({}, {__index = _G})
setfenv(assert(loadfile("lib/parsel.lua") or loadfile("../lib/parsel.lua"), "Cannot find parsel"), parsel)()
local textutils = assert(loadfile("lib/pprint.lua") or loadfile("../pprint.lua"), "Cannot find pprint")()
local a = parsel.symbol "a"
local abtest = (a/"b"/"test"):many()
local braces = abtest:between("{", "}")
local p = (abtest .. braces) % function(res) return { outer = res[1], inner = res[2]} end
@SquidDev
SquidDev / LASM.JSON-tmLanguage
Last active August 29, 2015 14:10
Sublime Language for LuaAssemblyTools (https://github.com/mlnlover11/LuaAssemblyTools)
// [PackageDev] target_format: plist, ext: tmLanguage
{
"name": "Lua Assembly",
"scopeName": "source.lasm",
"fileTypes": ["lasm"],
"uuid": "3507f71d-f02d-4af7-ab7d-027c8e7313de",
"patterns": [
{
"beginCaptures": {