Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nigilan Palanisamy nigilan

🎯
Focusing
View GitHub Profile
@nigilan
nigilan / npmsetup.ps1
Created Sep 26, 2017
This piece of code is to run commands in powershell as administrator.
View npmsetup.ps1
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
# Get the ID and security principal of the current user account
$myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent();
$myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID);
# Get the security principal for the administrator role
$adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator;
# Check to see if we are currently running as an administrator
@nigilan
nigilan / app.js
Created May 13, 2018
To pass port in command line and also to close the server
View app.js
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send({"mess": "hello world"});
});
const portArrayPointer = process.argv.indexOf("--port");
if (portArrayPointer) {
View controllers.application.js
import Ember from 'ember';
import EmberObject from '@ember/object';
let India = EmberObject.create({
capital : 'New Delhi'
});
let China = EmberObject.create({
capital : 'Beijing'
View index.html
<!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">
@nigilan
nigilan / winstonLogger.js
Created Nov 3, 2017
Winston logger and daily rotator
View winstonLogger.js
/**
* Configurations of logger.
*/
const winston = require('winston');
process.env.NODE_ENV = "production";
const env = process.env.NODE_ENV;
const fs = require('fs');
var util = require('util');
const logDir = 'applicationlog';