Skip to content

Instantly share code, notes, and snippets.

@legokichi
Last active August 16, 2016 05:41
Show Gist options
  • Save legokichi/c3d5420057bcb554dc11 to your computer and use it in GitHub Desktop.
Save legokichi/c3d5420057bcb554dc11 to your computer and use it in GitHub Desktop.
dtsm local repo
interface Console{
snapshot(cnv: HTMLCanvasElement): void;
screenshot(cnv: HTMLCanvasElement, scale?:number): void;
image(url: string): void;
}
declare type NumberArray = number[]
//|Uint8ClampedArray
|Uint8Array|Uint16Array|Uint32Array
|Int8Array|Int16Array|Int32Array
|Float32Array|Float64Array;
declare class FFT {
constructor (bufferSize: number, sampleRate: number);
forward(input: NumberArray): void;
inverse(real: NumberArray, imag: NumberArray): Float32Array;
spectrum: Float32Array;
real: Float32Array;
imag: Float32Array;
}
{
"repos": [
{
"url": "https://github.com/borisyankov/DefinitelyTyped.git",
"ref": "master"
},
{
"url": "https://gist.github.com/c3d5420057bcb554dc11.git",
"ref": "master"
}
],
"path": "typings",
"bundle": "typings/tsd.d.ts",
"link": {
"npm": {
"include": true
}
},
"dependencies": {
"encoding-japanese/encoding.d.ts": {
"repo": "https://gist.github.com/c3d5420057bcb554dc11.git",
"ref": "c0b1301f2011b7a47ef0940dd97b9e9efe89f2e5",
"path": "encoding.d.ts"
},
"surfaces_yaml/surfaces_txt2yaml.d.ts": {
"repo": "https://gist.github.com/c3d5420057bcb554dc11.git",
"ref": "010ee905f42187a972abb76821b32633ef41d8ac",
"path": "surfaces_txt2yaml.d.ts"
}
}
}
// https://github.com/polygonplanet/encoding.js/blob/master/README_ja.md
declare module Encoding {
/*
function orders();
function detect();
*/
function convert(
data: number[]|Uint8Array|Uint16Array|Uint32Array|Int8Array|Int16Array|Int32Array|Float32Array|Float64Array|ArrayBuffer,
to_encoding: string,
from_encoding: string): number[];
function convert(
data: number[]|Uint8Array|Uint16Array|Uint32Array|Int8Array|Int16Array|Int32Array|Float32Array|Float64Array|ArrayBuffer,
options: {
to: string,
from: string,
type: string,
bom: boolean}): number[];
function convert(data: string, to_encoding: string, from_encoding: string): string;
function convert(
data: string,
options: {to: string,
from: string,
type: string,
bom: boolean}): string;
/*
function urlEncode();
function urlDecode();
*/
function codeToString(
data: number[]|Uint8Array|Uint16Array|Uint32Array|Int8Array|Int16Array|Int32Array|Float32Array|Float64Array|ArrayBuffer
): string;
/*
function stringToCode();
function toHankakuCase();
function toZenkakuCase();
function toHiraganaCase();
function toKatakanaCase();
function toHankanaCase();
function toZenkanaCase();
function toHankakuSpace();
function toZenkakuSpace();
*/
}
declare module "encoding-japanese" {
export = Encoding;
}
// Type definitions for jsqrcode
// Project: https://github.com/LazarSoft/jsqrcode
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface jsqrcode{
binarize(src:number): boolean[];
callback(result: string): void;
debug: boolean;
decode(): string;
decode(src: string): void;
decode_url(url:string): string;
decode_utf8(url:string): string;
getMiddleBrightnessPerArea(image:number[]): number[][];
getPixel(x:number, y:number): number;
grayScaleToBitmap(grayScale: number[]): number[];
grayscale(): number[];
height: number;
isUrl(url:string): boolean;
imagedata: ImageData;
maxImgSize: number;
orderBestPatterns(patterns: any): any;
process(ctx: CanvasRenderingContext2D): string;
qrCodeSymbol: any;
sizeOfDataLengthInfo: number[][];
width: number;
}
declare var qrcode: jsqrcode;
// Generated by typings
// Source: https://gist.githubusercontent.com/legokichi/c3d5420057bcb554dc11/raw/39f6b9a3852daed2d88c75b737247c59eccb4c3a/NarLoader.d.ts
declare module NarLoader {
function loadFromBuffer(buffer: ArrayBuffer): Promise<NanikaDirectory>;
function loadFromURL(url: string): Promise<NanikaDirectory>;
function loadFromBlob(blob: Blob): Promise<NanikaDirectory>;
}
declare class NanikaFile {
constructor(file: ArrayBuffer);
//constructor(file: JSZipObject);
toString(): string;
buffer(): ArrayBuffer;
valueOf(): ArrayBuffer;
}
declare class NanikaDirectory {
constructor(
files: {[path_to_file: string]: NanikaFile;},
options?: {has_install?: boolean, has_descript?: boolean});
files: {[path_to_file: string]: NanikaFile;};
install: {[key: string]: string;};
descript: {[key: string]: string;};
asArrayBuffer(): {[path_to_file: string]: ArrayBuffer;};
listChildren(): string[];
addDirectory(dir: NanikaDirectory, options?: {has_descript: boolean}): NanikaDirectory;
getDirectory(dirpath: string, options?: {has_descript: boolean}): NanikaDirectory;
wrapDirectory(dirpath: string, options?: {has_descript: boolean}): NanikaDirectory;
getElements(elempaths: string[], options?: {has_descript: boolean}): NanikaDirectory;
removeElements(elmpaths: string[], options?: {has_descript: boolean}): NanikaDirectory;
hasElement(elempath: string[]): boolean;
}
declare module "narloader" {
export = {
NarLoader: NarLoader,
NanikaFile: NanikaFile,
NanikaDirectory: NanikaDirectory
}
}
interface QRCodeJS{
new (cnv: HTMLElement, text: string): QRCodeJS;
new (canvas_id: string, vOption: {
text: string;
width: number;
height: number;
colorDark: string;
colorLight: string;
}): QRCodeJS;
clear(): void;
makeCode(data: string): void;
makeImage(): void;
CorrectLevel: {L: number, M: number, Q: number, H: number};
}
declare var QRCode: QRCodeJS;
// Generated by typings
// Source: https://gist.githubusercontent.com/legokichi/c3d5420057bcb554dc11/raw/8267e95a31b0bcee392a100f29b34f1480aeda9e/surfaces_txt2yaml.d.ts
declare module SurfacesTxt2Yaml {
export interface SurfacesTxt {
charset: string;
descript: SurfaceDescript;
surfaces: { [key: string]: SurfaceDefinition; };
aliases: { [scope: string]: { [aliasname: string]: number[]; }; };
regions: { [scope: string]: {[regionName: string]: ToolTipElement}; };
}
export interface ToolTipElement {
tooltip: string;
cursor: {
mouseup: string;
mousedown: string;
};
}
export interface SurfaceDescript {
version: number;
maxwidth: number;
"collision-sort": string;
"animation-sort": string;
}
export interface SurfaceDefinition {
is: number;
characters: { sakura: string; };
points: {
centerx: number;
centery: number;
kinoko: { centerx: number; centery: number; },
basepos: { x: number; y: number; };
};
balloons: {
sakura: { offsetx: number; offsety: number; };
offsetx: number;
offsety: number;
};
regions: { [key: string]: SurfaceRegion; };
animations: { [key: string]: SurfaceAnimation; };
elements: { [key: string]: ElementPattern; };
base: string[];
}
export interface ElementPattern {
is: number,
type: string,
file: string,
x: number,
y: number
}
export interface SurfaceAnimation {
is: number;
interval: string;
option: string;
patterns: SurfaceAnimationPattern[];
regions: { [key: string]: SurfaceRegion; };
}
export interface SurfaceAnimationPatternBase {
// 'overlay', 'overlayfast', 'reduce', 'replace', 'interpolate', 'asis', 'bind', 'add', 'reduce', 'move'
type: string;
surface: number;
wait: string;
x: number;
y: number;
}
export interface SurfaceAnimationPatternAlternative extends SurfaceAnimationPatternBase {
// 'alternativestart', 'alternativestop'
animation_ids: number[];
}
export interface SurfaceAnimationPatternInsert extends SurfaceAnimationPatternBase {
// 'insert', 'start', 'stop'
animation_id: string;
}
export type SurfaceAnimationPattern = SurfaceAnimationPatternBase | SurfaceAnimationPatternAlternative | SurfaceAnimationPatternInsert;
export interface SurfaceRegionBase {
is: number;
name: string;
type: string;
}
export interface SurfaceRegionRect extends SurfaceRegionBase {
left: number;
top: number;
right: number;
bottom: number;
}
export interface SurfaceRegionCircle extends SurfaceRegionBase {
center_x: number;
center_y: number;
radius: number;
}
export interface SurfaceRegionEllipse extends SurfaceRegionBase {
left: number;
top: number;
right: number;
bottom: number;
}
export interface SurfaceRegionPolygon extends SurfaceRegionBase {
coordinates: { x: number; y: number; }[];
}
export type SurfaceRegion = SurfaceRegionRect | SurfaceRegionCircle | SurfaceRegionEllipse | SurfaceRegionPolygon;
export function txt_to_data(text: string, option?: {}): SurfacesTxt;
}
declare module "surfaces_txt2yaml" {
export = SurfacesTxt2Yaml;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment