Skip to content

Instantly share code, notes, and snippets.

View r37r0m0d3l's full-sized avatar

Anton Trofymenko r37r0m0d3l

View GitHub Profile
@r37r0m0d3l
r37r0m0d3l / node-pdf-generator.js
Created August 13, 2020 10:03 — forked from adamgibbons/node-pdf-generator.js
Display or download PDF from node.js server
var restify = require('restify')
, port = process.env.PORT || 3000
, Phantom = require('phantom')
, tmpdir = require('os').tmpdir()
, fs = require('fs');
var server = restify.createServer();
function setResponseHeaders(res, filename) {
res.header('Content-disposition', 'inline; filename=' + filename);
@r37r0m0d3l
r37r0m0d3l / Dockerfile
Created August 3, 2020 08:20 — forked from mjul/Dockerfile
Running R scripts in a Docker container
FROM r-base:latest
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
CMD ["Rscript", "myscript.R"]
export interface IFacadeObject {
[key: string]: any;
}
export interface IFacadeResponse {
objects: IFacadeObject[];
size: {
height: number;
width: number;
};
class WebElement {
public x: number;
public y: number;
// More code here
}
class EditorPaneElement {
public static getHumanReadableCoordinates(element: WebElement) {
return `[x:${element.x},y:${element.y}]`;
}
@r37r0m0d3l
r37r0m0d3l / es6-compose.md
Created June 20, 2020 17:16 — forked from JamieMason/es6-compose.md
ES6 JavaScript compose function

ES6 JavaScript Compose Function

Definition

const compose = (...fns) =>
  fns.reduceRight((prevFn, nextFn) =>
    (...args) => nextFn(prevFn(...args)),
    value => value
 );
@r37r0m0d3l
r37r0m0d3l / docker-compose.yml
Created May 22, 2020 10:42 — forked from louisbl/docker-compose.yml
docker-compose with db persistence
data:
image: debian:jessie
user: www-data
volumes:
- ./src:/var/www/
web:
image: php:5.6-apache
links:
- db
function verboseRegExp(input) {
if (input.raw.length !== 1) {
throw Error('verboseRegExp: interpolation is not supported');
}
let source = input.raw[0];
let regexp = /(?<!\\)\s|[/][/].*|[/][*][\s\S]*[*][/]/g;
let result = source.replace(regexp, '');
@r37r0m0d3l
r37r0m0d3l / class_decorator.ts
Created April 20, 2020 22:52 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
# git clone https://github.com/NVlabs/stylegan2
import os
import numpy as np
from scipy.interpolate import interp1d
from scipy.io import wavfile
import matplotlib.pyplot as plt
import PIL.Image
import moviepy.editor
import dnnlib
const factorial = (n) => {
const next = n <= 1 ? () => n * 1 : () => n * factorial(n - 1);
return next();
};