Skip to content

Instantly share code, notes, and snippets.

View chandanch's full-sized avatar
📘
Design, Build, Transform, Graph, Nxt Gen Solutions 😀

Chandan CH chandanch

📘
Design, Build, Transform, Graph, Nxt Gen Solutions 😀
View GitHub Profile
/**
* Created by Chandan on 14/12/16.
* @Author Chandan
*
*/
import { Component, ViewChild, ElementRef } from '@angular/core';
import {Platform} from "ionic-angular";
//import pouchDB modules here
import * as PouchDB from 'pouchdb';
@chandanch
chandanch / mediaPlayer.json
Last active January 4, 2017 17:28
Demonstration of JSON to SaSS conversion
{
"play-buttton-color" : "#FF4578",
"pause-button-color" : "#EF86RW",
"album-art-border-color" : "#EQ3E56",
"track-title-font-size" : "14pt"
}
$play-buttton-color : #FF4578;
$pause-button-color : #EF86RW;
$album-art-border-color : #EQ3E56;
$track-title-font-size : 14pt;
<html lang = "en">
<head>
<link rel = "stylesheet"
href = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
<script language = "javascript">
@chandanch
chandanch / NavigationService.ts
Last active August 31, 2017 08:50
Handling navigation using events
import { Injectable } from "@angular/core";
import { Events } from "ionic-angular";
/**
* @desc Handle all the navigations and modal popup using this services.
*/
@Injectable()
export class NavigationService {
constructor(events : Events) {
Injectable.providerInit( (providerCore) => {
})
@chandanch
chandanch / app.component.ts
Last active August 31, 2017 09:43
Handling events in root component
export class MyApp {
constructor(private platform : Platform) {
this.platform.Ready().then(() =>
this.handleEvents();
)
}
handleEvents() {
this.events.subscribe("navigation", (eventData)=> {
this.nav.push(eventData.page, eventData.data)
});
@chandanch
chandanch / index.html
Created November 16, 2017 08:33
modernizr.custom.js
<ul><li class="canvas">canvas</li><li class="cookies">cookies</li><li class="customelements">customelements</li><li class="setclasses">setclasses</li></ul>
@chandanch
chandanch / dragdrop.html
Created November 20, 2017 12:56
A basic drag and drop example
<!DOCTYPE HTML>
<html>
<head>
<style>
#div1 {
width: 350px;
height: 370px;
padding: 10px;
border: 1px solid #aaaaaa;
}
@chandanch
chandanch / server.js
Created March 2, 2018 05:56
Server config file for hosting static web apps
var connect = require('connect');
var serveStatic = require('serve-static');
connect().use(serveStatic(__dirname)).listen(8080)

Handling Errors

Express.js makes it a breeze to handle errors in your routes.

Express lets you centralizes your error-handling through middleware.

Let's look at patterns for how to get the most out of your error-handling.

First, our error-handling middleware looks like this: