Skip to content

Instantly share code, notes, and snippets.

/**
* GET /api/file/:id
* Download an uploaded file.
*/
export let download = (req: Request, res: Response, next: NextFunction) => {
File.findByIdAndRemove(req.params.id).exec((err, file) => {
if (err) res.status(500).send(err);
if (!file) {
res.status(404).send('not found');
return;
@badri
badri / op.txt
Created May 17, 2018 06:50
Better results
--- Failed scenarios:
features/archive/sessions.feature:80
features/discussions/privacy.feature:25
features/miscellaneous/site_settings.feature:7
125 scenarios (117 passed, 3 failed, 5 undefined)
1255 steps (1218 passed, 3 failed, 6 undefined, 28 skipped)
13m55.29s (69.77Mb)
@badri
badri / op.txt
Created May 17, 2018 05:25
Behat output
--- Failed scenarios:
features/archive/sessions.feature:80
features/discussions/privacy.feature:25
125 scenarios (100 passed, 2 failed, 23 undefined)
1255 steps (1096 passed, 2 failed, 59 undefined, 98 skipped)
15m6.36s (70.64Mb)
--- FeatureContext has missing steps. Define them with these snippets:
@badri
badri / docker-entrypoint.sh
Created April 11, 2018 14:15
MongoDB docker image init script with user provided credentials
#!/bin/bash
set -Eeuo pipefail
if [ "${1:0:1}" = '-' ]; then
set -- mongod "$@"
fi
originalArgOne="$1"
# allow the container to be started with `--user`
FROM lakshminp/node-platform:1.0
FROM postgres:lastest
FROM lakshminp/python-platform:1.0
FROM lakshminp/php-platform:1.9
@badri
badri / .gitlab-ci.yml
Created February 16, 2018 15:36
Gitlab CI behat
image: tetraweb/php:7.1
services:
- mariadb:latest
variables:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
@badri
badri / cbv_multiple_forms.html
Created January 18, 2018 04:03
Django multiple forms code with sample usage
{% extends "base.html" %}
{% block content %}
<form method="post">{% csrf_token %}
{{ forms.subscription }}
<input type="submit" value="Subscribe">
</form>
<form method="post">{% csrf_token %}
{{ forms.contact }}
<input type="submit" value="Send">