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
@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
-----------------------------------------------------------------------------
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
-----------------------------------------------------------------------------
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
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
@SquidDev
SquidDev / 00-Dropbox.md
Last active December 28, 2016 21:54
CC-Dropbox

ComputerCraft-Dropbox

A Dropbox script that can be used in ComputerCraft. Also provides an FS like API which could be wrapped like a virtual file system.

Usage

The syntax is quite simple:

--- 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()
@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.`"
@SquidDev
SquidDev / HashColour.py
Created August 6, 2013 10:29
Some colour functions to generate a function from the current time or from a string.
import time, hashlib
def GenRGBColour(string):
md=hashlib.md5()
md.update(string)
HexColour=md.hexdigest()
return [int(HexColour[0:2], 16), int(HexColour[2:4], 16), int(HexColour[4:6], 16)]
def GenRandomColour():
return GenRGBColour(str(time.time()))
* {
animation-name: example;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
/* Standard syntax */
@keyframes example {
0% {transform:rotate(0deg)}