Skip to content

Instantly share code, notes, and snippets.

@sr229
Created October 24, 2016 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sr229/7cbe744f02c6c73b2e43b2ce265924dd to your computer and use it in GitHub Desktop.
Save sr229/7cbe744f02c6c73b2e43b2ce265924dd to your computer and use it in GitHub Desktop.
just another try to do a TypeScript Script
/*
* Just another retarded TypeScript made by a lazy twat
* just to learn the lang itself
* and to donate something for /r/LoveLive
*
* Yes, it's Licensed under MIT too.
*/
const strings = input.split("");
class Vector {
constructor(
public x: number,
public y: number,
public z: number
) { }
static times(k: number, v: Vector) { return new Vector(k * v.x, k * v.y, k * v.z); }
static minus(v1: Vector, v2: Vector) { return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z); }
static plus(v1: Vector, v2: Vector) { return new Vector(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); }
static dot(v1: Vector, v2: Vector) { return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; }
static mag(v: Vector) { return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z); }
static norm(v: Vector) {
var mag = Vector.mag(v);
var div = (mag === 0) ? Infinity : 1.0 / mag;
return Vector.times(div, v);
}
static cross(v1: Vector, v2: Vector) {
return new Vector(v1.y * v2.z - v1.z * v2.y,
v1.z * v2.x - v1.x * v2.z,
v1.x * v2.y - v1.y * v2.x);
}
}
class Scale {
constructor(
public x : number,
public y : number,
public z : number
){}
static scale(k: number, v: Scale) { return new Scale(k * v.x, k * v.y, k * v.z); }
}
class bustSize{
constructor(
public input : string,
public width = (Vector.string.split("").x),
public output : string
){
return bustSize;
}
}
class kanan {
public idolStatus = ["terminated"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment