- install dependencies
- setup .eslintrc to the root of your project
- run
eslint .
Install all needed dependencies
const winston = require('winston'); | |
const MESSAGE = Symbol.for('message'); | |
const jsonFormatter = (logEntry) => { | |
const base = { timestamp: new Date() }; | |
const json = Object.assign(base, logEntry) | |
logEntry[MESSAGE] = JSON.stringify(json); | |
return logEntry; | |
} |
function fullSync(page = 1) { | |
let open = indexedDB.open("books", 1); | |
// Set up the database schema | |
open.onsuccess = evt => { | |
let db = open.result; | |
fullSyncPage(db, 1); | |
}; | |
} |
files: | |
"/opt/elasticbeanstalk/env.vars": | |
mode: "000775" | |
owner: root | |
group: users | |
content: | | |
# enable extra logs | |
set -xe | |
# Defines variables for use by the other scripts below. |
const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
const asyncForEach = async (array, callback) => { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array) | |
} | |
} | |
const start = async () => { | |
await asyncForEach([1, 2, 3], async (num) => { | |
await waitFor(50) |
# This CMake file will build Freetype and Harfbuzz as external | |
# projects. We follow the build description as described here: | |
# https://sourceforge.net/projects/freetype/files/freetype2/2.5.3/ So, | |
# first we build Freetype2 w/o Harfbuzz, then we build Harfbuzz with | |
# freetype support after which we rebuild Freetype2 again. | |
# | |
# Both CMake files of Freetype2 and Harfbuzz are depending on | |
# pkg-config to find the dependencies for both projects. I've | |
# included a patch for Freetype2 and Harfbuzz which allows you to | |
# build Freetype2 and Harbuzz with pure CMake features. So I removed |
// At top, import immutable | |
import { Map } from 'immutable'; | |
// Later, in constructor... | |
this.state = { | |
// Create an immutable map in state using immutable.js | |
user: Map({ firstName: 'Cory', lastName: 'House'}) | |
}; | |
updateState({target}) { |
# By default, Docker containers run as the root user. This is bad because: | |
# 1) You're more likely to modify up settings that you shouldn't be | |
# 2) If an attacker gets access to your container - well, that's bad if they're root. | |
# Here's how you can run change a Docker container to run as a non-root user | |
## CREATE APP USER ## | |
# Create the home directory for the new app user. | |
RUN mkdir -p /home/app |
#!/bin/sh | |
mkdir task | |
cp build_weasyprint.sh task | |
docker run --rm -it -v $PWD/task:/var/task \ | |
-e LD_LIBRARY_PATH='/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib' \ | |
lambdalinux/baseimage-amzn build_weasyprint.sh |
/* | |
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects. | |
It will generate several classes such as: | |
.m-r-10 which gives margin-right 10 pixels. | |
.m-r-15 gives MARGIN to the RIGHT 15 pixels. | |
.m-t-15 gives MARGIN to the TOP 15 pixels and so on. | |
.p-b-5 gives PADDING to the BOTTOM of 5 pixels | |
.p-l-40 gives PADDING to the LEFT of 40 pixels |