Skip to content

Instantly share code, notes, and snippets.

View rajasegar's full-sized avatar

Rajasegar Chandran rajasegar

View GitHub Profile
@rajasegar
rajasegar / How_to_use.html
Created February 25, 2016 16:58 — forked from jcgregorio/How_to_use.html
HTML Templating using the HTML <template> element and exactly 100 lines of JS. A cleaned up version of this code is now available at https://github.com/jcgregorio/stamp/.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script src="templating.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<template id=t>
@rajasegar
rajasegar / introrx.md
Created December 26, 2016 13:46 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@rajasegar
rajasegar / ember-x-tabs-bar.hbs
Created May 12, 2017 10:50
Ember x tabs bar style
{{#x-tab tab-style="tabs-style-bar" as |tab| }}
{{!-- tab navigation --}}
{{#x-tab/navigation}}
{{#x-tab/nav-wrap paneId="home" tab=tab}}
<i class="icon icon-home"></i>
<span>Home</span>
{{/x-tab/nav-wrap}}
{{#x-tab/nav-wrap paneId="archive" tab=tab}}
<i class="icon icon-box"></i>
@rajasegar
rajasegar / communicational-cohesion.js
Created March 27, 2018 13:27
Communication cohesion
function timeToRetire(birthday) { // birthday is a date
const RETIREMENT_AGE = 65;
let ageDifMs = Date.now() - birthday.getTime();
let ageDate = new Date(ageDifMs); // miliseconds from epoch
let age = Math.abs(ageDate.getUTCFullYear() - 1970)
let _timeToRetire = RETIREMENT_AGE - age;
return _timeToRetire;
}
const RETIREMENT_AGE = 65;
function calculateAge(birthday) {
let ageDifMs = Date.now() - birthday.getTime();
let ageDate = new Date(ageDifMs); // miliseconds from epoch
return Math.abs(ageDate.getUTCFullYear() - 1970)
}
function calcRetirementTime(age) {
return RETIREMENT_AGE - age;
function printSummary(summary) {
// Print the summary data
// Re-initialize the summary data
}
function printReport(summary) {
}
function initialize(summary) {
}
function printSummary(summary) {
printReport(summary);
initialize(summary);
}
function completeNewEmployee() {
// startup logic here
// Read configuration file
// Init scratch file
// etc
// shutdown logic here
}
function startup() {
function inputAll(opFlag) {
switch(opFlag) {
case 'TIME_CARD':
// Input all the employee time-card information
break;
case 'INVENTORY':
// Input all the inventory data
break;
case 'CUSTOMER':
// Input all the customer names
function inputTimeCard(timeCard) {
// Input all the employee time-card information
}
function inputInventory(inventory) {
// Input all the inventory data
}
function inputCustomer(customer) {
// Input all the customer names