Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
getting things done 💪🏻

Ludovic Wyffels ludovicwyffels

🤠
getting things done 💪🏻
View GitHub Profile
View loop-for-of.js
const arr = [2,4,5,6,8,9];
for(let num of arr) {
console.log(num);
}
const str = 'JavaScript';
for(let letter of str) {
console.log(letter);
View loop-for-in.js
let obj = {
a: 1,
b: 2,
c: 3,
d: 9
};
console.log(obj.propertyIsEnumerable('a'));
for (let key in obj) {
View loop-for-in-enumerable-false.js
let obj = {};
Object.defineProperty(obj, 'a', {
value: 1,
enumerable: false
});
Object.defineProperty(obj, 'b', {
value: 2,
enumerable: false
View docker-nodeApp-basic
FROM node:8
WORKDIR /home/nodejs/app
COPY . .
RUN npm install --production
CMD [“node”, “index.js”]
View docker-nodeApp-secure-part1
FROM node:8
RUN groupadd -r nodejs && useradd -m -r -g -s /bin/bash nodejs nodejs
USER nodejs
...
View docker-nodeApp-secure-part2
FROM node:8
RUN groupadd -r nodejs && useradd -m -r -g -s /bin/bash nodejs nodejs
USER nodejs
WORKDIR /home/nodejs/app
COPY package.json .
RUN npm install --production
View docker-nodeApp-secure
FROM node:8
RUN groupadd -r nodejs && useradd -m -r -g -s /bin/bash nodejs nodejs
USER nodejs
WORKDIR /home/nodejs/app
COPY package.json .
RUN npm install --production
View docker-tag
# !/bin/sh
docker tag helloworld:latest yourorg/helloworld:$SHA1
docker tag helloworld:latest yourorg/helloworld:$BRANCH_NAME
docker tag helloworld:latest yourorg/build_$BUILD_NUM
View example.js
const GeoJSON = require('./geojson');
const data = [
{ name: 'Location A', category: 'Store', street: 'Market', lat: 39.984, lng: -75.343 },
{ name: 'Location B', category: 'House', street: 'Broad', lat: 39.284, lng: -75.833 },
{ name: 'Location C', category: 'Office', street: 'South', lat: 39.123, lng: -74.534 }
];
console.log(GeoJSON.parse(data, {Point: ['lat', 'lng']}));
View log-entry-function.ts
import logger from '../logSetup';
getInstallment(month: number, count: number ): number {
logger.debug(`>>>> Entering getInstallment(month = ${month}, count= ${count}`);
// process
const installment: number = 3;
log.debug('<<<< Exiting getIntallment()');
return installment;