Skip to content

Instantly share code, notes, and snippets.

View Markvandersteen's full-sized avatar

Mark van der Steenhoven Markvandersteen

View GitHub Profile
@Markvandersteen
Markvandersteen / image.js
Last active January 14, 2020 04:20
Simple Express image route upload for CKEditor with multer middleware
multer = require('multer');
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, 'public/uploads/images/')
}
});
var upload = multer({ storage: storage });
module.exports = function (app) {
@Markvandersteen
Markvandersteen / oneWayDataFlow.js
Last active June 12, 2019 11:16
one way data flow vue props and data
props: ['initialCounter'],
data: function () {
return {
counter: this.initialCounter
}
}
import { NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
import axios, { AxiosRequestConfig } from 'axios';
export class ReverseProxyMiddleware implements NestMiddleware {
after(str, substr): string {
return str.slice(str.indexOf(substr) + substr.length, str.length);
}
use(req: Request, res: Response, next: NextFunction) {
if (process.env.NODE_ENV != 'dev' || !process.env.PROXY) {
// EmptyBucket will empty a s4bucket.
func EmptyBucket(bucket string, s3Aws *s3.S3) error {
params := &s3.ListObjectsInput{
Bucket: aws.String(bucket),
}
for {
//Requesting for batch of objects from s3 bucket
objects, err := s3Aws.ListObjects(params)
if err != nil {
body {
white-space: pre;
font-family: 'Source Code Pro', monospace;
color: white;
background: #282C34;
}
.property {
color: #DB6A73;
font-weight: bold;
alias glist="git for-each-ref --count=20 --sort=-committerdate refs/heads/ --format='%(authordate:short) %(color:red)%(objectname:short) %(color:yellow)%(refname:short)%(color:reset) (%(color:green)%(committerdate:relative)%(color:reset))'"