This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check the prototype | |
function init(args){ | |
if (Object.getPrototypeOf(this) !== init.prototype) { | |
// called without `new` | |
return new init(args); | |
} | |
this.args = args; | |
} | |
// check the constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSObjectExtension.h | |
// KeyOUcare | |
// | |
// Created by CYWang on 2015/1/27. | |
// Copyright (c) 2015年 OUcare. All rights reserved. | |
// | |
#ifndef KeyOUcare_NSObjectExtension_h | |
#define KeyOUcare_NSObjectExtension_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassName : NSObject { | |
static var i = 0 | |
// static / class function (seems the same) | |
static func fn() {} | |
class func fn2() {} | |
init() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:void document.getElementById('youtubePlayer').remove(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SEP = '.'; | |
/** | |
* traversal an object and flatten its nested objects property keys, | |
* concatted by a `.` into a single level non-nested object | |
* | |
* @param obj object | |
* | |
* @returns object | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Asset { | |
abstract getDetails(): string[]; | |
} | |
class Machine implements Asset { | |
constructor( | |
private readonly machineId: number, | |
private readonly machineModel: string, | |
private readonly machineName: string, | |
) {} |
OlderNewer