Skip to content

Instantly share code, notes, and snippets.

View dimpu's full-sized avatar
🏠
Working from home

Dimpu Aravind Buddha dimpu

🏠
Working from home
View GitHub Profile
@dimpu
dimpu / DynamicComponentMyComponent.ts
Created August 29, 2018 05:19
Dynamic Component Creation in Angular 4+
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
import { DynamicComponentService } from '../DynamicComponentService';
@Component({
selector: 'my-app',
template: `<div #container></div>`
})
export class MyAppComponent {
@ViewChild('container', { read: ViewContainerRef }) container: ViewContainerRef;
@dimpu
dimpu / DynamicComponentService.ts
Last active August 29, 2018 04:59
Dynamic component creation for Angualr4+
import { Injectable, Component, NgModule, Compiler } from '@angular/core';
// Import any other module that may required by your dynamic component
import { FormsModule } from '@angular/forms';
@Injectable({
providedIn: 'root'
})
export class DynamicComponentService {
constructor(private compiler:Compiler) { }
@dimpu
dimpu / corn_git_hub_push.py
Last active December 21, 2017 05:25
Corn git-hub push
# This scrips require schedule,gitpython
# pip3 install schedule
# pip3 install gitpython
import string
import random
import datetime
import schedule # this is for shedule
import time
function task(my_task){
return new Promise((resolve,reject)=>{
setTimeout(function(){
if(my_task == 'find loki'){
resolve();
}else{
reject();
}
},2000);
});
'use strict';
import Person from './Person';
let p = new Person();
class Person{
//some Code here
}
export default Person;
'use strict';
let avenger = { tony:'tony',says:'Sometimes you gotta run before you can walk.'};
let {tony,says} = avenger;
console.log(tony);
console.log(says);
'use strict';
let tony = 'tony';
let says = 'Sometimes you gotta run before you can walk.';
let avanger = {tony,says};
console.log(avanger);//Object {tony: "tony", says: "Sometimes you gotta run before you can walk."}
//es5
var html = '<div class="form-group">'+
'<label class="sr-only" for="">label</label>'+
'<input type="email" class="form-control" id="" placeholder="Input field">'+
'</div>';
console.log(html);
//es6
'use strict';
let html = `<div class="form-group">
<label class="sr-only" for="">label</label>
//es5
var avenger = "tony";
var says = "Sometimes you gotta run before you can walk.";
console.log(avenger+" says "+says);
//es 6
"use strict";
let avenger = "tony";
let says = "Sometimes you gotta run before you can walk.";
console.log(`${avenger} says ${says}`);