Optional - Set format on save and any global prettier options
npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
| import * as Sequelize from "sequelize"; | |
| import uuidv1 = require("uuid/v4"); | |
| import { SequelizeModelStatic } from "./sequelize"; | |
| import * as pLimit from "p-limit"; | |
| import _ = require("lodash"); | |
| /** | |
| * Get generated SQL query from sequelize. Returns a promise that: | |
| * 1. Adds a hook that receives the prepared options from Sequelize | |
| * - Since hooks work on the whole model, |
| CREATE OR REPLACE FUNCTION `project-id.dataset-id.html_to_text`(text STRING) AS ( | |
| TRIM( | |
| REGEXP_REPLACE( | |
| REGEXP_REPLACE( | |
| REGEXP_REPLACE( | |
| REGEXP_REPLACE( | |
| REGEXP_REPLACE( | |
| LOWER(text), | |
| r"<br>|<br\/>|<br\s+\/>|<\/p>", "\n"), | |
| r"<[^>]*>", ""), |
| Africa/Abidjan | |
| Africa/Accra | |
| Africa/Addis_Ababa | |
| Africa/Algiers | |
| Africa/Asmara | |
| Africa/Asmera | |
| Africa/Bamako | |
| Africa/Bangui | |
| Africa/Banjul | |
| Africa/Bissau |
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
export SECRETNAME=acmeorg
| // get transaction | |
| const transaction = await sequelize.transaction(); | |
| try { | |
| // step 1 | |
| await Model.destroy({where: {id}}, {transaction}); | |
| // step 2 | |
| await Model.create({}, {transaction}); | |
| // commit |
| FROM golang:1.9 | |
| WORKDIR /go/src/github.com/purplebooth/example | |
| COPY . . | |
| RUN go build -ldflags "-linkmode external -extldflags -static" -a main.go | |
| FROM scratch | |
| COPY --from=0 /go/src/github.com/purplebooth/example/main /main | |
| CMD ["/main"] |
| -- without using SET variable | |
| SELECT t.id, | |
| t.count, | |
| (@running_total := @running_total + t.count) AS cumulative_sum | |
| FROM TABLE t | |
| JOIN (SELECT @running_total := 0) r | |
| ORDER BY t.id | |
| -- with SET variable | |
| SET @running_total := 0; |
| /* | |
| * React.js Material-UI Table and TableRow components with flexible height and fixed header | |
| * - fixes "jumping" scrolling bar in WebKit browsers | |
| * - shows permanent scrolling bar for other browsers | |
| * | |
| * Usage: import this Table and TableRow component instead of | |
| * 'material-ui/Table' and 'material-ui/TableRow' component | |
| */ | |
| import React, {PropTypes} from 'react'; |