This is based of the Type hinting for scalar variables with some optimisations for for strings.
##Loose/weak values
This are values that represent that type. For instance 2 is an integer as is 2.0 and '2.0'. This is similar for floats.
| 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())) |
| --JSON functions | |
| --Credit goes to http://www.computercraft.info/forums2/index.php?/topic/5854-json-api-v201-for-computercraft/ | |
| ------------------------------------------------------------------ utils | |
| local controls = {["\n"]="\\n", ["\r"]="\\r", ["\t"]="\\t", ["\b"]="\\b", ["\f"]="\\f", ["\""]="\\\"", ["\\"]="\\\\"} | |
| local whites = {['\n']=true; ['r']=true; ['\t']=true; [' ']=true; [',']=true; [':']=true} | |
| function removeWhite(str) | |
| while whites[str:sub(1, 1)] do | |
| str = str:sub(2) |
| local Args = {...} --Read Args | |
| local Files = { } --All Files to include | |
| local OutHandle = nil --File Handle to write to | |
| local getDir = fs.getDir or function(str) | |
| return str:match("(.*/)") | |
| end |
| from functools import wraps | |
| class NotifyProperty(property): | |
| def __init__(self, Get, Set = None, Del = None, Doc = None): | |
| Setter = None | |
| if Set != None: | |
| @wraps(Set) | |
| def Setter(self, Value): | |
| Set(self, Value) | |
| self.Notify(Set.__name__, Value) | |
This is based of the Type hinting for scalar variables with some optimisations for for strings.
##Loose/weak values
This are values that represent that type. For instance 2 is an integer as is 2.0 and '2.0'. This is similar for floats.
Fun stuff with AST trees in python.
pow and min into maxtuples into listsprint statements into listsreturn x,y,z into _ = [x,y,z]| using System; | |
| using MathNet.Numerics.LinearAlgebra; | |
| using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| namespace Testing | |
| { | |
| [TestClass] | |
| public class UnitTest1 | |
| { | |
| [TestMethod] |
| // [PackageDev] target_format: plist, ext: tmLanguage | |
| { | |
| "name": "Lua Assembly", | |
| "scopeName": "source.lasm", | |
| "fileTypes": ["lasm"], | |
| "uuid": "3507f71d-f02d-4af7-ab7d-027c8e7313de", | |
| "patterns": [ | |
| { | |
| "beginCaptures": { |