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
public class Base | |
{ | |
public long _id; | |
public Base(long id) | |
{ | |
this._id = id; | |
} | |
} | |
public class A : Base |
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
public class Singleton | |
{ | |
private static readonly Lazy<Singleton> _lazy = new Lazy<Singleton>( | |
() => new Singleton(), isThreadSafe: true); | |
public static Singleton Instance | |
{ | |
get | |
{ | |
return Singleton._lazy.Value; |
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
function Class() | |
{ | |
if(!(this instanceof Class)) | |
{ | |
return new Class(); | |
} | |
} | |
var _obj = Class(); |
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
var arrayForEach = function (array, action) | |
{ | |
for (var i = 0, j = array.length; i < j; i++) | |
{ | |
action(array[i]); | |
} | |
}; | |
//Usage |
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
'use strict'; | |
let path = require('path'); | |
let express = require('express'); | |
let compression = require('compression'); | |
// Constants | |
let PORT = 8080; | |
// App |
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
import { NgModuleRef, ApplicationRef, Type } from '@angular/core'; | |
import { createNewHosts, createInputTransfer, removeNgStyles } from '@angularclass/hmr'; | |
/** | |
* Adds HMR to an existing Angular Module | |
* | |
* Credits & References: | |
* https://webpack.github.io/docs/hot-module-replacement.html | |
* https://github.com/AngularClass/angular2-hmr | |
* https://medium.com/@beeman/tutorial-enable-hrm-in-angular-cli-apps-1b0d13b80130 |
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
import { Component, OnInit, Input } from '@angular/core'; | |
import { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/observable/interval'; | |
import 'rxjs/add/observable/from'; | |
import 'rxjs/add/operator/zip'; | |
import 'rxjs/add/operator/repeat'; | |
@Component({ | |
selector: 'image-carousel', | |
template: ` |
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
@Component({ | |
selector: 'app-root', | |
template: `` | |
}) | |
export class AppComponent implements OnInit { | |
private componentRef; | |
constructor( | |
private componentFactoryResolver: ComponentFactoryResolver, | |
private injector: Injector |
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
@Component({ | |
selector: 'my-header', | |
template: `<h1>{{ title }}</h1>` | |
}) | |
export class HeaderComponent { | |
title = 'Hello World'; | |
constructor() { | |
setTimeout(_ => { | |
this.title = 'Updated!'; |
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
import { DomPortalHost, Portal, ComponentPortal } from '@angular/cdk/portal'; | |
@Component({ | |
selector: 'my-app', | |
template: '', | |
}) | |
export class AppComponent implements OnInit { | |
private portalHost: DomPortalHost; | |
private portal: ComponentPortal<HeaderComponent>; |
OlderNewer