Skip to content

Instantly share code, notes, and snippets.

@CoderPuppy
CoderPuppy / textEscapes.lua
Last active August 29, 2015 13:57
ComputerCraft Text Escapes API
-- Text Escapes API by CoderPuppy
-- Usage:
-- textEscapes.print(textEscapes.textLime .. "Hello World!" .. textEscapes.textWhite)
-- Prints "Hello World!" in lime
-- textEscapes.print(textEscapes.textGrey .. textEscapes.backYellow .. "HI!!!" .. textEscapes.reset)
-- Prints "HI!!!" in grey with a yellow background
defaultOpts = {
textColor = true;
backColor = true;
@CoderPuppy
CoderPuppy / dish.lua
Last active August 29, 2015 13:58
Doggish Shell
local styles
if term.isColor() then
styles = {
prompt = {
text = colors.yellow;
back = colors.black;
};
input = {
text = colors.white;
back = colors.black;
@CoderPuppy
CoderPuppy / chatbot.lua
Last active August 29, 2015 13:58
Chat Bot API for my Chat Server
-- Chat Bot API by CoderPuppy
local protocol = 'cpup/chat'
function createBot(hostname, username)
local bot = {
id = math.random(1, 2147483647);
hostname = hostname;
username = username;
}
@CoderPuppy
CoderPuppy / chatclient.lua
Last active August 29, 2015 13:58
Client for my Chat Server
-- Chat Client by CoderPuppy
-- Requires textEscapes and chatbot
pcall(function()
os.loadAPI('chatbot.lua')
_G.chatbot = _G['chatbot.lua']
end)
pcall(function()
os.loadAPI('chatbot')
@CoderPuppy
CoderPuppy / chatserver.lua
Last active November 8, 2015 10:37
Chat Server
-- Chat Server by CoderPuppy
local protocol = 'cpup/chat'
local tArgs = { ... }
local function printUsage()
print('Usages:')
print('chatserver.lua <hostname>')
end
---- Minecraft Crash Report ----
// Don't be sad. I'll do better next time, I promise!
Time: 5/5/14 11:59 AM
Description: Unexpected error
java.lang.NullPointerException: Unexpected error
at java.util.regex.Matcher.getTextLength(Matcher.java:1234)
at java.util.regex.Matcher.reset(Matcher.java:308)
at java.util.regex.Matcher.<init>(Matcher.java:228)
@CoderPuppy
CoderPuppy / ae.fy
Last active August 29, 2015 14:01
Applied Energistics like system written in Fancy
class ItemSpec {
read_slots: ('name, 'dmg, 'data)
def initialize: @name with_dmg: @dmg with_data: @data
def initialize: @name with_dmg: @dmg
def initialize: @name with_data: @data {
@dmg = 0
}
def initialize: @name {
@dmg = 0
}
/*
* robotMaze.js
*
* The blue key is inside a labyrinth, and extracting
* it will not be easy.
*
* It's a good thing that you're a AI expert, or
* we would have to leave empty-handed.
*/
type Identifier
id::String
end
getter(env, id::Identifier) = env[id.id]
assigner(env, id::Identifier, val) = env[id.id] = val
type Access
obj::Any
key::Any
end
type Identifier
id::String
end
getter(env, id::Identifier) = env[id.id]
assigner(env, id::Identifier, val) = env[id.id] = val
type Access
obj::Any
key::Any
end