Skip to content

Instantly share code, notes, and snippets.

import { Component, OnInit } from '@angular/core';
import {BaseComponent} from '../core/baseComponent';
import {_Private} from '../core/_private';
let _private;
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.css']
})
export class BaseComponent {
private _private : Object;
constructor(){
this._private = {};
}
public createPrivate(key,value){
this._private[key] = value;
Object.defineProperty(this,key,{
set(value){
@fahimc
fahimc / EventBus.js
Last active April 11, 2018 09:56
This is an event bus plugin for component.js
const EventBus = {
listenerCollection:{},
init() {
ComponentManager.plugins.push(EventBus.inject);
},
inject(instance) {
instance.getEventBus = function() {
return EventBus;
}
},
@fahimc
fahimc / StateManager.js
Last active March 28, 2018 09:38
ComponentJS StateManager Plugin
const StateManager = {
_state:{},
set(dotNotationKey,value){
this.dotNotation(dotNotationKey,value);
this.dispatchToAll();
},
get(dotNotationKey){
return dotNotationKey.split('.').reduce((o,i)=>o[i], this._state);
},
init() {
@fahimc
fahimc / _npm-run-dist
Last active March 7, 2018 10:47
NPM Dist Task
```cmd
npm install
npm run dist
```
@fahimc
fahimc / dev-cli-config.json
Last active March 12, 2018 13:10
This is the configuration file for dev-cli npm module. Here is where the boilerplates are listed.
{
"boilerplates":{
"componentjs":{
"name": "componentjs boilerplate",
"repoLink":"https://github.com/fahimc/component-boilerplate.git",
"install": "npm install"
},
"babel":{
"name": "babel boilerplate",
"repoLink":"https://github.com/fahimc/babel-seed.git",
server {
listen 80;
server_name 198.58.105.111;
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
include snippets/self-signed.conf;
include snippets/ssl-params.conf;
#ssl_certificate /etc/letsencrypt/live/service.epiphanycoins.com/fullchain.$
#ssl_certificate_key /etc/letsencrypt/live/service.epiphanycoins.com/privke$
#ssl_trusted_certificate /etc/letsencrypt/live/service.epiphanycoins.com/fu$
server {
listen 80;
server_name [IP/Domain];
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control';
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {