Skip to content

Instantly share code, notes, and snippets.

View majidkn's full-sized avatar
😎
How u doin'?

Majid Nayyeri majidkn

😎
How u doin'?
  • Iran
  • 02:49 (UTC +03:30)
View GitHub Profile
@majidkn
majidkn / input.js
Created October 12, 2021 10:24
Getting input from stdin in Node.js
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
@majidkn
majidkn / nginx.conf
Created March 5, 2018 20:47
Nginx Config For Reading Angular Builded Files (/dist)
server {
listen 80;
server_name {server_name};
root /home/{username}/{project_folder}/dist;
index index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.html =404;
}
@majidkn
majidkn / zeroAdder.js
Last active February 27, 2018 21:46
Add zeros(0) behind a number depend on length of final number
zeroAdder = function (number, length) {
fixedNumber = ''
for (var i = length - 1; i >= Math.floor(number).toString().length; i--) {
fixedNumber += '0'
}
fixedNumber += number.toString()
return fixedNumber;
}
function calculateNewPrice(mainPrice, discount){
discount = typeof discount === 'undefined' ? 10 : discount;
return mainPrice * (100-discount) / 100;
}
function calculateNewPrice(mainPrice, discount = 10){
return mainPrice * (100-discount) / 100;
}
function calculateNewPrice(mainPrice, discount){
discount = discount || 10;
return mainPrice * (100-discount) / 100;
}
function calculateNewPrice(mainPrice, discount){
(discount)? discount: discount = 10;
return mainPrice * (100-discount) / 100;
}
function calculateNewPrice(mainPrice, discount){
(discount)? discount: discount = 10;
return mainPrice * (100-discount) / 100;
}
<tr ng-repeat="data in searchCtrl.myData | filter:searchInput ">
<table class="table table-striped">
<thead>
<tr>
<th>ID</th>
<th>Index</th>
<th>guID</th>
<th>isActive</th>
<th>Balance</th>
<th>Age</th>
<th>Favorite Fruit</th>