Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Roman ChugunovRoman

💭
I may be slow to respond.
Block or report user

Report or block ChugunovRoman

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
@ChugunovRoman
ChugunovRoman / .bashrc
Last active Oct 30, 2018
Alias for npm run with auto completing a npm scripts from package.json from current directory.
View .bashrc
alias nr="npm run"
_npm_scripts() {
# check package.json file in current directory
if [ ! -f ./package.json ]; then
return
fi
local scripts="$(node -e 'const { scripts } = require(`./package.json`); if (!scripts) process.exit(); let a = Object.entries(scripts); for (let s in scripts) { console.log(s); }' | grep -E ^$2)"
local -a toks
@ChugunovRoman
ChugunovRoman / .bashrc
Last active Oct 26, 2018
Auto completion for alias
View .bashrc
# load completion for git alias
_completion_loader git
__git_complete gb _git_branch
__git_complete gck _git_checkout
__git_complete gd _git_diff
__git_complete gc _git_commit
__git_complete gl _git_log
__git_complete ga _git_add
@ChugunovRoman
ChugunovRoman / combinations.js
Last active Oct 12, 2018
All possible combinations of elements in array
View combinations.js
#! /usr/bin/node
const Readable = require('stream').Readable;
const stream = new Readable;
stream.on('data', chunk => {
console.log(JSON.parse(chunk.toString()));
});
@ChugunovRoman
ChugunovRoman / Gulpfile.js
Last active Jun 27, 2018
Gulp for make a C++ app (In develop still)
View Gulpfile.js
const fs = require('fs');
const path = require('path');
const cp = require('child_process');
const gulp = require('gulp'),
watch = require('gulp-watch');
if (process.env.PROJECT == "") {
console.error(`You need specified the PROJECT=<project_folder> env. This variable indicates to project dir, which need to build.`);
return;
@ChugunovRoman
ChugunovRoman / c_cpp_properties.json
Last active Jun 26, 2018
Configuration file for VSCode for integrate with C++ (In this case with Qt C++) (Need to install the C/C++ extension from Microsoft)
View c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${env.HOME}/Qt5.9.6/5.9.6/gcc_64/include/**",
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
@ChugunovRoman
ChugunovRoman / server.mjs
Created Jun 21, 2018
Express static server with Read/Write json file
View server.mjs
/**
* Server side for issuance client scripts
*/
import path from "path";
import Express from 'express';
import BodyParser from "body-parser";
import { readFile, writeFile } from "./util";
@ChugunovRoman
ChugunovRoman / webpack.config.dev.js
Created Jun 21, 2018
Webpack config for TypeScript + React + DevServer + Hot Reload + Sass + AutoPrefixer
View webpack.config.dev.js
const webpack = require('webpack');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const { CheckerPlugin } = require('awesome-typescript-loader');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const prefixer = require('autoprefixer');
const path = require('path');
const rootFolder = process.cwd();
@ChugunovRoman
ChugunovRoman / server.mjs
Created Jun 21, 2018
Simple static server with Expressjs
View server.mjs
import path from "path";
import Express from 'express';
const root = process.cwd();
const p = path.resolve(root, 'build');
const app = Express();
app.use(Express.static(p));
app.get('/', (req, res) => {
@ChugunovRoman
ChugunovRoman / .gitlab-ci.yml
Created Jun 18, 2018
Deploy Electron app with gitlab ci
View .gitlab-ci.yml
# https://<example.com>/<namespace>/<project>/-/jobs/artifacts/<tag>/download?job=pages
# https://<example.com>/<namespace>/<project>/-/jobs/artifacts/<tag>/raw/<path_to_file>?job=pages
# Where:
# example.com - domain name your gitlab server
# namespace - your name user on the gitlab
# project - your project
# tag - ref of current job.
# If job run on only by tags, than ref will be named as tag name
# If job run on only master, than ref will be named as "master", i.e.: https://<example.com>/<namespace>/<project>/-/jobs/artifacts/master/download?job=pages
# path_to_file - path to file relative from root workspace folder
You can’t perform that action at this time.