Skip to content

Instantly share code, notes, and snippets.

View DKunin's full-sized avatar
🎯
Focusing

Dmitri Kunin DKunin

🎯
Focusing
View GitHub Profile
@DKunin
DKunin / .jshintrc
Created February 10, 2015 07:32
.jshintrc
{
"maxerr" : 15,
"newcap": false,
"browser": true,
"curly": true,
"freeze": true,
"indent": 4,
"esnext": true,
"globals": {
"module": true,
@DKunin
DKunin / README.md
Last active August 29, 2015 14:23 — forked from jczaplew/README.md
Setting up PM2 launch deamon

Setting up a LaunchDaemon with pm2

If you have a Node.js app running on an OS X server, you probably:

  • Want it to start automatically when the system boots
  • Want to use something like pm2 or forever to monitor the status of the app, log errors, and make sure it stays up

While pm2 has the ability to generate startup scripts for use with Ubunutu, Centos, and systemd, it does not work with OS X. The best approach is to use launchd, an OS X-specific daemon manager that replaces cron. It uses XML-based files for configuration. This guide will walk you through the process. Note: "xyz" is used as a placeholder for the application name throughout this guide.

Instructions

@DKunin
DKunin / regexp.js
Created November 26, 2015 07:53
Regexp and search examples
\s.+background: -(moz|o|ms|webkit-gr).+;
/Users/dikunin/Projects/avito/var, -build/*, -vendor/*, -3rdparty/*, *.css, *.styl
function scrollTo(element, to, duration) {
if (duration <= 0) {
return;
}
var difference = to - element.scrollTop;
var perTick = difference / duration * 10;
setTimeout(() => {
element.scrollTop = element.scrollTop + perTick;
if (element.scrollTop === to) {
{
// Simply using `node` without specifying a path sometimes doesn't work :(
// https://github.com/victorporof/Sublime-HTMLPrettify#oh-noez-command-not-found
// http://nodejs.org/#download
"node_path": {
"windows": "node.exe",
"linux": "/usr/bin/nodejs",
"osx": "/Users/dikunin/.nvm/versions/node/v0.12.7/bin/node"
},
@DKunin
DKunin / nbes_get_adblock_status.js
Created July 29, 2016 12:45
Somekind of adblock detector
function nbes_get_adblock_status()
{
var patt = new RegExp("Android");
var res = patt.test(window.navigator.userAgent);
var patt1 = new RegExp("UCBrowser");
var res1 = patt.test(window.navigator.userAgent);
if(res && res1)
{
nbes_loaded = true;
@DKunin
DKunin / inject-mousetrap.js
Last active September 8, 2016 10:35
Inject Mousetrap
(function(d, script) {
script = d.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.onload = function(){
console.log(Mousetrap)
};
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.4.6/mousetrap.min.js';
var head = d.getElementsByTagName('body')[0];
head.appendChild(script);
@DKunin
DKunin / Responses.md
Last active March 16, 2017 15:46
Email Templates

Not interested:

Добрый день! Благодарю за интерес к моему профилю! На данный момент я не заинтересован в смене места деятельности. Хорошего дня и удачи в поиске.

Not interested, money:

Добрый день!

На данный момент я не нахожусь в активном поиске. Я иногда рассматриваю перспективные вакансии с окладом 250К+ на руки. Если мои компенсационные ожидания могут быть удовлетворены, то нам есть смысл пообщатся подробнее.

@DKunin
DKunin / copyRecursiveSync.js
Last active September 8, 2016 09:48
copyRecursiveSync
var copyRecursiveSync = function(src, dest) {
if (existsAndAFolder(src)) {
if (!existsAndAFolder(dest)) {
fs.mkdirSync(dest);
}
fs.readdirSync(src).forEach(function(childItemName) {
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
});
} else if (!fs.existsSync(dest)) {

Keybase proof

I hereby claim:

  • I am dkunin on github.
  • I am dkunin (https://keybase.io/dkunin) on keybase.
  • I have a public key whose fingerprint is 27ED 8B59 E575 22D8 55C0 2F4C A145 4B68 071A DA70

To claim this, I am signing this object: