Skip to content

Instantly share code, notes, and snippets.

@mav-erick
mav-erick / ays-app.module.ts
Created April 3, 2019 19:39
AYS app module
import { BrowserModule } from "@angular/platform-browser";
import { NgModule, Injector } from "@angular/core";
import { AysComponent } from "./ays/ays.component";
import { createCustomElement } from "@angular/elements";
@NgModule({
declarations: [AysComponent],
imports: [BrowserModule],
entryComponents: [AysComponent]
@mav-erick
mav-erick / ays-index.html
Last active April 3, 2019 19:08
AYS test html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<style>
.jacked-up {
font-size: 50px;
@mav-erick
mav-erick / ays-build-element.js
Created April 3, 2019 19:02
AYS build-element.js
const fs = require("fs-extra");
const concat = require("concat");
(async function build() {
const files = [
"./dist/ays/runtime.js",
"./dist/ays/polyfills.js",
"./dist/ays/scripts.js",
"./dist/ays/main.js"
];
await fs.ensureDir("ays");
@mav-erick
mav-erick / ays-app.component.html
Created April 3, 2019 18:42
AYS App component
<ays (select)="handleClick($event)"></ays>
import {
Component,
ViewEncapsulation,
Input,
Output,
EventEmitter,
ChangeDetectionStrategy,
OnInit
} from "@angular/core";
import tingle from "./tingle";
@mav-erick
mav-erick / ays-tingle.js
Created April 3, 2019 18:32
AYS - Tingle modal
!(function(t, o) {
"function" == typeof define && define.amd
? define(o)
: "object" == typeof exports
? (module.exports = o())
: (t.tingle = o());
})(this, function() {
function t(t) {
var o = {
onClose: null,
@mav-erick
mav-erick / instructions.md
Last active September 1, 2018 15:17
Deploying MongoDB Google one click

Click to deploy

  1. Choose two instances and an arbiter instance. (Min required config for a replica set)
  2. SSH into the primary instance (determined by rs.status())
  3. Create a dbuser admin with root permissions
  4. Verify that the user is good
  5. Create a keyFile with openssl command.
  6. Paste the keyFile to both the instances.
  7. chmod 700 file and sudo chown mongodb:mongodb file
  8. stop both instances.
  9. Edit config file enable security authentication, give keyFile path to the one created
@mav-erick
mav-erick / app.component.html
Last active July 29, 2018 04:59
Google places autocomplete - app.component.html v2
<div style="text-align:center">
<h1>
Welcome to {{ title }}!
</h1>
<img width="300" alt="Angular Logo">
</div>
<div class="input-container">
<input
type="text"
class="google-place-input"
@mav-erick
mav-erick / app.component.ts
Last active July 22, 2018 21:19
Google places autocomplete app.component.ts v2
import { Component, NgZone } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public title = 'Places';
public addrKeys: string[];
@mav-erick
mav-erick / google-place.directive.ts
Last active July 22, 2018 21:20
Google place directive with event emitter
import { Directive, ElementRef, OnInit, Output, EventEmitter } from '@angular/core';
declare var google:any;
@Directive({
selector: '[google-place]'
})
export class GooglePlacesDirective implements OnInit {
@Output() onSelect: EventEmitter<any> = new EventEmitter();
private element: HTMLInputElement;