Skip to content

Instantly share code, notes, and snippets.

View ilKhr's full-sized avatar
🏠
Working from home

Khorishko Ilya ilKhr

🏠
Working from home
View GitHub Profile
@seeliang
seeliang / convert-ejs-to-html.js
Last active September 1, 2023 16:09
use node to generate html from ejs file
const ejs = require('ejs');
const fs = require('fs');
module.exports = ({template, config}) => {
fs.readFile(template, 'utf8', (err, data) => {
if (err) { console.log(err); return false; }
var ejs_string = data,
template = ejs.compile(ejs_string),
html = template(config);
fs.writeFile(template.replace('.ejs', '') + '.html', html, (err) => {
if(err) { console.log(err); return false }
@diegodalbosco
diegodalbosco / dialogflow-fulfillment.d.ts
Last active February 25, 2021 19:56 — forked from slowtick/dialogflow-fulfillment.d.ts
Deprecate set/getContext and add context.set/get
declare module 'dialogflow-fulfillment' {
import { DialogflowConversation } from 'actions-on-google';
import { Request, Response } from 'express';
export class Card extends RichResponse {
constructor(card: string | object);
public setButton(button: {
text: string,
url: string,
@tomasevich
tomasevich / nginx_nodejs.md
Last active May 23, 2024 14:37
Сервер в связке Nginx + NodeJs

Сервер в связке Nginx + NodeJs

Данная пошаговая инструкция поможет освоить основы на простом примере

Для справки

Сервер поднимался на Debian 8 c характеристиками:

CPU - 1 ядро x 500 МГц

@DaoWen
DaoWen / docker-cleanup
Created September 11, 2017 14:42
Clean up inactive docker instances and images
#!/bin/bash
# Remove unused instances
dead_instances="$(docker ps -aq -f status=exited)"
[ "$dead_instances" ] && docker rm $dead_instances
# Remove unused images
dead_images="$(docker image ls | awk '/^<none> +<none>/ { print $3 }')"
[ "$dead_images" ] && docker rmi $dead_images
@javilobo8
javilobo8 / download-file.js
Last active May 27, 2024 21:00
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);