Skip to content

Instantly share code, notes, and snippets.

View tkssharma's full-sized avatar
🎯
only JS

codewithtkssharma tkssharma

🎯
only JS
View GitHub Profile
import {Component} from '@angular/core';
import {DemoService} from './demo.service';
@Component({
selector: 'demo-app',
template:`
<h1>Angular2 HTTP Demo App</h1>
<h2>Foods</h2>
<div *ngIf="foods_error">An error occurred while loading the foods!</div>
<ul>
import {Component} from '@angular/core';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'app',
template: `
<b>Angular 2 Component Using Observables!</b>
<div>Values: {{values.toString()}}</div>
<div>Errors? {{anyErrors}}</div>
<div>Finished? {{finished}}</div>
var obs = Rx.Observable.interval(500).take(5)
.do(i => console.log("obs value "+ i) );
obs.subscribe(value => console.log("observer 1 received " + value));
obs.subscribe(value => console.log("observer 2 received " + value));
var express = require('express');
var Item = require('models').Item;
var app = express();
var itemRoute = express.Router();
itemRoute.param('itemId', function(req, res, next, id) {
Item.findById(req.params.itemId, function(err, item) {
req.item = item;
next();
});
var Hapi = require('hapi');
var Item = require('models').Item;
var server = Hapi.createServer('0.0.0.0', 8080);
server.ext('onPreHandler', function(req, next) {
if (req.params.itemId) {
Item.findById(req.params.itemId, function(err, item) {
req.item = item;
next();
});
var loopback = require('loopback');
var app = module.exports = loopback();
var Item = loopback.createModel(
'Item',
{
description: 'string',
completed: 'boolean'
}
);
@tkssharma
tkssharma / devops_training.txt
Created December 21, 2016 11:40 — forked from ssmythe/devops_training.txt
Training materials for DevOps
======
Videos
======
DevOps
What is DevOps? by Rackspace - Really great introduction to DevOps
https://www.youtube.com/watch?v=_I94-tJlovg
Sanjeev Sharma series on DevOps (great repetition to really get the DevOps concept)
======
Videos
======
DevOps
What is DevOps? by Rackspace - Really great introduction to DevOps
https://www.youtube.com/watch?v=_I94-tJlovg
Sanjeev Sharma series on DevOps (great repetition to really get the DevOps concept)
@tkssharma
tkssharma / gist:ad8584edfc96ba37e3be497b2251c492
Created January 7, 2017 13:25
aws EC-2 startup script for Code Deploy
#!/bin/bash
yum install -y aws-cli
cd /home/ec2-user/
aws s3 cp 's3://aws-codedeploy-us-east-1/latest/codedeploy-agent.noarch.rpm' . --region us-east-1
yum -y install codedeploy-agent.noarch.rpm
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "A simple description of what this template does",
"Parameters": {
//variables that can be passed to the template during deployment.
},
"Mappings": {
//keys which match to a corresponding set of named values
}
"Resources": {