Skip to content

Instantly share code, notes, and snippets.

View melihovv's full-sized avatar

Alexander Melihov melihovv

  • Russia, Volgograd
View GitHub Profile
@melihovv
melihovv / pre-commit
Created June 15, 2015 19:47
Pre-commit hook.
#!/usr/bin/env node
"use strict";
var path = require('path');
var execSync = require('child_process').execSync;
var hook = path.basename(__filename);
var config = require(path.resolve(process.cwd(), 'package'));
if (!config[hook]) {
process.exit(0);
}
@melihovv
melihovv / log.js
Created June 18, 2015 14:19
Winston's wrapper for configurable logging.
var winston = require('winston');
module.exports = function (module) {
return makeLogger(module.filename);
};
function makeLogger(path) {
// File app.js -> log to console and file 'debug.log'.
if (path.match(/app.js$/)) {
var transports = [
@melihovv
melihovv / gulpfile.js
Created June 18, 2015 20:57
Gulpfile to reload server and browser during development.
var gulp = require('gulp');
var nodemon = require('gulp-nodemon');
var livereload = require('gulp-livereload');
gulp.task('default', function () {
livereload.listen();
nodemon({
// Main script.
script: 'app.js',
@melihovv
melihovv / .cvimrc
Last active August 29, 2015 14:26
My personal config for cVim
" Settings
let blacklists = ["https://trello.com/*","http://www.codewars.com/*"]
set noautofocus
" Mappings
map о j
map л k
@melihovv
melihovv / main.cpp
Last active December 31, 2015 19:33
Qt Tests Stub
#include "testsrunner.h"
int main(int argc, char* argv[])
{
return RUN_ALL_TESTS(argc, argv);
}
@melihovv
melihovv / main.cpp
Last active August 29, 2015 14:27
Qt Tests Colorifier
#include <windows.h>
#include <iostream>
#include <string>
#include <regex>
enum Color
{
blue = 1, green, cyan, red, purple, yellow, grey, dgrey, hblue, hgreen, hcyan, hred, hpurple, hyellow, hwhite
};
@melihovv
melihovv / unknow-extension.reg
Last active December 29, 2015 15:53
Allows to bind program which opens files with unknown extensions.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Unknown\shell]
@="sublime"
[HKEY_CLASSES_ROOT\Unknown\shell\gvim]
@="Open with gvim"
[HKEY_CLASSES_ROOT\Unknown\shell\gvim\command]
@="C:\\Program Files (x86)\\Vim\\vim74\\gvim.exe %1"
@melihovv
melihovv / main.cpp
Last active December 11, 2015 12:32
gtest stub
#include <gtest/gtest.h>
int main(int argc, char* argv[])
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
@melihovv
melihovv / build-x64.bat
Last active June 24, 2016 01:36
Build Qt 5.5.1 from source with MSVC 2015 on Windows
REM http://pempek.net/articles/2015/10/18/compiling-qt-5-5-1-with-visual-studio-2015/
REM Set up \Microsoft Visual Studio 2015
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
ECHO ON
SET _CD=%CD%
SET _PATH=%PATH%
SET ICU_SOURCE=%_CD%\tools\icu-54.1\source
SET ICU_DIST=%_CD%\tools\icu-54.1\dist-64
@melihovv
melihovv / dbg.h
Last active January 14, 2016 07:53
C debug macros
#ifndef DBG_H
#define DBG_H
#include <stdio.h>
#include <errno.h>
#include <string.h>
#ifdef NDEBUG
# define DEBUG(M, ...)
#else