Skip to content

Instantly share code, notes, and snippets.

@nkt
nkt / dump.js
Created February 26, 2015 17:48
Simple function for node.js debugging
function dump(what, depth, colors) {
var util = require('util');
console.log(util.inspect(what, {
depth: depth || 2,
colors: colors === undefined ? true : colors
}));
}
function initDnD(element, cb, accept = 'image/*') {
let input = document.createElement('input');
input.type = 'file';
input.accept = accept;
input.addEventListener('change', (e) => {
cb(input.files[0]);
});
element.addEventListener('click', (e) => {
e.preventDefault();
input.click();
HTTP Working Group                         T. Berners-Lee, MIT/LCS
INTERNET-DRAFT                              R. Fielding, UC Irvine
<draft-ietf-http-v10-spec-05.html>             H. Frystyk, MIT/LCS
Expires August 19, 1996                          February 19, 1996

Hypertext Transfer Protocol -- HTTP/1.0

@nkt
nkt / rfc.css
Created April 4, 2015 23:24
Make rfc texts more human readable
body {
font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;
font-size: 16px;
line-height: 1.6;
width: 1000px;
margin: 0 auto;
word-wrap: break-word;
}
a[href] {
@nkt
nkt / example.js
Created April 20, 2015 12:58
Simple slack integration in node project.
const notifier = require('./notifier');
notifier.sendMessage('Hello world!').then((res) => {
// handle response
}).catch((e) => {
console.error(e);
});
#!/usr/bin/osascript
tell application "Skype"
if (send command "GET MUTE" script name "MuteToggler") is equal to "MUTE ON" then
send command "SET MUTE OFF" script name "MuteToggler"
else
send command "SET MUTE ON" script name "MuteToggler"
end if
end tell
@nkt
nkt / post-merge
Created May 31, 2015 21:26
Frontend git hooks
#!/bin/sh
# List changed files
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_file() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
check_file "package.json" "npm install"
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
module.exports = {
foo: 'bar'
};
},{}],2:[function(require,module,exports){
var foo = require('./foo.js');
},{"./foo.js":1}]},{},[2]);
const React = require('react');
const classNames = require('classnames');
const Input = React.createClass({
propTypes: {
id: React.PropTypes.string.isRequired,
className: React.PropTypes.string,
title: React.PropTypes.string,
help: React.PropTypes.string,
type: React.PropTypes.oneOf([
@nkt
nkt / README.md
Last active August 29, 2015 14:23
CLI Yandex.Translate

Usage

trans hello # привет
trans hello | say # it's saying!