Skip to content

Instantly share code, notes, and snippets.

View SshPwd's full-sized avatar
🌴
On vacation

Noname SshPwd

🌴
On vacation
View GitHub Profile

1

Review/Engagement reference: https://github.com/pilgrimconsulting/bam-new-item-portal/blob/staging/frontend/src/app/item/view/view.component.ts

Component name: view.component.ts

Finding description Location(S) Severity Recommendation
if ((col.field === 'action' or col.field === 'upc') or (selected.indexOf(col.field) >= 0)) Line 67 Recommended action and upc should be moved to constants of the items service

Question: A bunch of pirates go onto the sea to loot and be merry. They sign an agreement between them, describing each pirate’s part of the loot, and what happens if they find more or less loot than anticipated. Due to pirate politics, it’s not as straightforward as one might have guessed.

A charter looks like this:

var piratePair = [
  { portion:10, grow:1, shrink:1 },
  { portion:10, grow:1, shrink:1 }
];
@SshPwd
SshPwd / cmd.sh
Created July 28, 2017 11:04 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@SshPwd
SshPwd / mongo-docker.bash
Created July 18, 2017 09:20 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@SshPwd
SshPwd / docker-cleanup.sh
Created July 18, 2017 07:11 — forked from jgornick/docker-cleanup.sh
Docker: Cleanup (Remove all exited containers and dangling images)
#!/bin/bash
docker rm $(docker ps -q -f status=exited)
docker rmi $(docker images -q -f dangling=true)
{
'1': { // Center Progressive
'1': {
normal: [40, 41, 45],
infos: [],
error: []
},
'3': {
normal: [46],
@SshPwd
SshPwd / request.js
Created June 10, 2017 18:53 — forked from wouterbulten/request.js
Wrapper for fetch
import 'whatwg-fetch';
/**
* Requests a URL, returning a promise
*
* @param {string} url The URL we want to request
* @param {object} [options] The options we want to pass to "fetch"
*
* @return {object} An object containing either "data" or "err"
*/

LPT-API install documentation

Requirements

  • NodeJS >= 6.x.
  • OS Ubuntu 16.04
  • MongoDB >= 2.x

Proccess Of Installation

  • Install proccess manager pm2 by following comand npm install -g pm2
  • Clone the project repo git clone https://github.com/tbzr/lpt-lab-api
@SshPwd
SshPwd / promises_reduce.js
Created May 25, 2017 13:02 — forked from anvk/promises_reduce.js
Sequential execution of Promises using reduce()
function asyncFunc(e) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(e), e * 1000);
});
}
const arr = [1, 2, 3];
let final = [];
function workMyCollection(arr) {