Skip to content

Instantly share code, notes, and snippets.

"use strict";
let funcRegex = /^\s*function(\*)?\s*(?:\s+(.+?))?\((.*?)\)\s*{\s*(.*?)\s*}\s*$/m;
let arrowFuncRegex = /^\s*\(?(.*?)\)?\s*=>\s*{?\s*(.*?)\s*}?\s*$/m;
let parameterRegex = /^\s*(\.\.\.)?(.+?)(?:\s*=\s*(.+?))?\s*$/m;
/** Inspects the specified function and returns an object containing
* information about it and its parameters. Note: This breaks down
* when using certain strings or functions as default value parameters. */
exports.inspectFunction = function(func) {
import { Server as WebSocketServer } from "uws";
import winston from "winston";
import Client from "./Client";
import { AsyncEventEmitter } from "../../common/utility";
const defaultOptions = {
wssOptions: {
port: 8080
/*
* O/==================================\O *
* |====[ obsidian Engine Language ]====| *
* |====[ ~ Definition ~ ]====| *
* O\==================================/O *
*
* Motivated by JAI, another language in development:
* https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md
* Also taking some inspiration from C#.
* Work In Progress ... obviously.
@copygirl
copygirl / Iterable.js
Last active June 24, 2016 23:35
JavaScript iterable wrapper class with many utility functions
"use strict";
let Iterable = module.exports = class Iterable {
constructor(iterable) {
if (iterable instanceof Function)
this[Symbol.iterator] = iterable;
else if (Iterable.isIterable(iterable))
this[Symbol.iterator] = iterable[Symbol.iterator].bind(iterable);
else throw new Error("iterable is neither a function nor an iterable");
@copygirl
copygirl / entity_system.rs
Created July 16, 2016 01:36
Tiny ECS storage in Rust using hash maps (WIP)
use std::any::Any;
use std::any::TypeId;
use std::hash::Hash;
use std::collections::HashMap;
#[derive(PartialEq, Eq, Clone, Copy, Hash, Debug)]
pub struct Entity(i32);
pub trait Component: Any { }
/** Represents arbitrary data that can be added to any object that implements IComponentsProvider.
* For example: Block, Item, Entity, ItemStack, Enchantment, Biome, ...
*
* Components are required to have an empty public constructor so they can be loaded / saved and
* getOrCreate can be used. */
public interface IComponent {
/** Serializes (saves) this component as an NBT tag.
* If null is returned, the component won't be saved. */
Tag serialize() { return null; }
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using EntitySystem.Utility;
namespace EntitySystem.Collections
{
public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue>
name: copypack
description: ...
authors: [ nikky, copygirl ]
links:
website: ...
source: ...
issues: ...
donations: ...
minecraftVersion: 1.11.2
import options, tables
import ../entity
template simpleTableComponent*(Type, name) =
let table = newTable[Entity, Type]()
proc name*(entity: Entity): Option[Type] =
try: table[entity].some
except KeyError: Type.none
package net.mcft.copy.backpacks.client.gui.test;
import net.minecraft.client.gui.GuiScreen;
import net.mcft.copy.backpacks.client.config.BackpacksGuiConfig;
import net.mcft.copy.backpacks.client.gui.Direction;
import net.mcft.copy.backpacks.client.gui.GuiContainer;
import net.mcft.copy.backpacks.client.gui.GuiContainerScreen;
import net.mcft.copy.backpacks.client.gui.GuiLayout;
import net.mcft.copy.backpacks.client.gui.control.GuiButton;