Skip to content

Instantly share code, notes, and snippets.

@dmastag
dmastag / todo.ts
Created November 5, 2016 04:41
Move ModelRegister and Model into the todo.ts file
// import { Model } from '@mean-expert/model/index';
/**
* @module Todo
* @description
* Write a useful Todo Model description
**/
export class ModelRegister {
constructor(Model: any, reference: any) {
// Register reference
const orgCopyConfig = require('@ionic/app-scripts/config/copy.config');
orgCopyConfig.include.push({
src: 'node_modules/angularfire2/node_modules/firebase/firebase.js',
dest: 'www/assets/firebase.js'
});
module.exports = orgCopyConfig;
@dmastag
dmastag / .angular-cli.json
Created May 18, 2017 11:08
Example of adding scripts and styles
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "app-web"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
@dmastag
dmastag / app.module.ts
Created November 9, 2017 15:59
App Module for webpack 3.8.1 issues
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { MomentModule } from 'angular2-moment';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LazyLoadImageModule } from 'ng-lazyload-image';
exports.list = function(req, res){
req.getConnection(async (err,connection) => {
var dropdownFisikJln = await connection.query ('SELECT * FROM dropdownlist');
var query = await connection.query ('SELECT * FROM kebinamargaan');
res.redirect('kebinamargaan',{
page_title:"Customers - Node.js",
data: {
dataDropDown: dropdownFisikJln,
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@dmastag
dmastag / member.js
Created July 24, 2018 10:32
Cara di Loopback untuk memaksa penambahan Limit
Member.beforeRemote(
"prototype.__get__tickets",
async (ctx, instance, next) => {
if (!ctx.args.filter || !ctx.args.filter.limit) {
if (!ctx.args.filter) ctx.args.filter = {};
ctx.args.filter.limit = 10;
} else {
ctx.args.filter.limit = Math.min(ctx.args.filter.limit, 10);
}
}
/// Untuk model1
{
"name": "model2",
"base": "PersistedModel",
"mssql": {
"schema": "dbo",
"table": "model1"
}
}
@dmastag
dmastag / Dockerfile
Created January 24, 2019 05:10
Dockerfile for NodeJS with Puppeteer
FROM zenika/alpine-chrome:with-node
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD 1
COPY --chown=chrome package.json package-lock.json /usr/src/app/
RUN npm install --production
COPY --chown=chrome . /usr/src/app
WORKDIR /usr/src/app
ENTRYPOINT []
# run command
@dmastag
dmastag / home.ts
Last active September 18, 2019 06:21 — forked from andimariadi/home.ts
getToday
import {Component, ViewChild} from "@angular/core";
import {NavController, PopoverController} from "ionic-angular";
import { HttpClient } from "@angular/common/http";
import { HelperProvider } from '../../providers/helper/helper';
import { Storage } from "@ionic/storage";
@Component({