Skip to content

Instantly share code, notes, and snippets.

📝

Deni Baskovsky qertis

📝
Block or report user

Report or block qertis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@qertis
qertis / storage.js
Created Nov 11, 2019
Gridfs Storage
View storage.js
// https://www.npmjs.com/package/mongoose-gridfs
import database from 'database'
import Stream from 'stream'
const mongooseFS = require('mongoose-gridfs')
/**
* Storage
*/
export default class Storage {
@qertis
qertis / buffer-to-stream.js
Created Nov 11, 2019
Nodejs: Buffer to Stream
View buffer-to-stream.js
import Stream from 'stream'
// var buffer = ... something buffer
if (Buffer.isBuffer(bufer)) {
const stream = new Stream.PassThrough()
stream.end(bufer)
return stream
}
@qertis
qertis / bitbucket-pipelines.yml
Created Nov 11, 2019
Google Cloud SDK and Build and test and deploy
View bitbucket-pipelines.yml
image: node:10.7.0
pipelines:
default:
- step:
name: Install Google Cloud SDK and Build and test and deploy
caches:
- node
script:
- export CLOUDSDK_CORE_DISABLE_PROMPTS=1
@qertis
qertis / mongoose.flowtype.js
Created Nov 11, 2019
mongoose.flowtype.js
View mongoose.flowtype.js
import mongoose from 'mongoose';
export type MongoId = typeof mongoose.Types.ObjectId | {
toString(): string,
};
export type MongoOrScalarId = MongoId | string | number;
declare class MongooseDocumentFieldsT {
id: string | number;
_id: MongoOrScalarId;
@qertis
qertis / dialogflow-example.js
Created Jul 20, 2019
DialogFlow Entity Example
View dialogflow-example.js
const fs = require('fs')
var res = {
"id": "11ab1c11-1111-1111-1111-11c9bb639111",
"name": "EntityIntent",
"isOverridable": true,
"entries": [ // ограничение для DialogFlow 30000
],
"isEnum": true,
"automatedExpansion": false,
View gist:c02dde83c28adad67b96399a1f9db006
/* eslint-disable */
debugger
/* eslint-enable no-debugger */
@qertis
qertis / server.js
Created Feb 16, 2019
Node: Custom Simple Server
View server.js
(async function web() {
const http = require('http');
const url = require('url');
const path = require('path');
const fs = require('fs');
const WEB_PORT = Number(process.env.PORT) || 9000;
http.createServer((req, res) => {
const uri = url.parse(req.url).pathname;
let filename = path.join(process.cwd(), uri);
fs.exists(filename, (exists) => {
@qertis
qertis / nuxt.config.js
Created Jan 21, 2019
Nuxt.js: disable js minification
View nuxt.config.js
...
build: {
extend (config, ctx) {
config.plugins = config.plugins.filter((plugin) => plugin.constructor.name !== 'UglifyJsPlugin')
}
}
...
@qertis
qertis / tagReplacer.js
Created Jan 12, 2019
html body tag replacer
View tagReplacer.js
var jsPathRegex = /="\/_nuxt\/[\s\S]*?(.js)"/g;
`
<div>some</div>
<script src="/_nuxt/vendors.js" ></script>
`.replace(jsPathRegex, (a, b) => a.replace(b, '.js?build=' + 123))
@qertis
qertis / Список_продуктов.json
Created Jan 3, 2019
Список_продуктов.json
View Список_продуктов.json
This file has been truncated, but you can view the full file.
[
{
"picUrl": "http://www.calorizator.ru/sites/default/files/imagecache/product_512/product/7up.jpg",
"name": "7up",
"protein": null,
"fat": null,
"carbohydrate": 8.7,
"kcal": 38
},
You can’t perform that action at this time.