Skip to content

Instantly share code, notes, and snippets.

View nakolkin's full-sized avatar
🏠
Working from home

Artem Nikolaienko nakolkin

🏠
Working from home
View GitHub Profile
@nakolkin
nakolkin / sendsqs.js
Created February 16, 2018 13:55
AWS Lambda sample: Send received events to SQS as Message
var QUEUE_URL = 'https://sqs.us-east-1.amazonaws.com/{AWS_ACCUOUNT_}/matsuoy-lambda';
var AWS = require('aws-sdk');
var sqs = new AWS.SQS({region : 'us-east-1'});
exports.handler = function(event, context) {
var params = {
MessageBody: JSON.stringify(event),
QueueUrl: QUEUE_URL
};
sqs.sendMessage(params, function(err,data){
@nakolkin
nakolkin / heredoc-dockerfile.snip
Created October 19, 2017 12:38 — forked from abn/heredoc-dockerfile.snip
Dockerfile alternatives for heredoc
#printf
RUN printf '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
>> /tmp/hello
#echo
RUN echo -e '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
@nakolkin
nakolkin / latency.txt
Created July 17, 2017 13:04 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@nakolkin
nakolkin / rxDecorateDirective.js
Created February 2, 2016 15:30 — forked from sirbarrence/rxDecorateDirective.js
A function to decorate some stock AngularJS 1.x directives to accept RxJS Observables. Finished product of https://barrysimpson.net/posts/rx-directive-decorators and https://barrysimpson.net/posts/rx-directive-decorators-update1
'use strict';
function rxDecorateDirective($provide, directiveName) {
// Duck-typing function lifted from the rx.js source.
function isObservable(obj) {
return obj && typeof obj.subscribe === 'function';
}
$provide.decorator(directiveName + 'Directive', ['$delegate', 'rx', function($delegate, rx) {
var directiveConfig = $delegate[0];
@nakolkin
nakolkin / browserify_for_webpack_users.markdown
Created January 20, 2016 20:14
browserify for webpack users

browserify for webpack users

There's been a strange explosion in misinformation about browserify recently, particularly in comparisons to webpack.

Generally speaking, most of this confusion stems from how webpack is more willing to pull features into its core to ease discoverability while browserify is more likely to push features out to userland instead.

I think that longer-term, separability has more benefits from a maintenance and

@nakolkin
nakolkin / index.html
Created November 23, 2015 12:00 — forked from anonymous/index.html
JS Bin Exercise Blank // source http://jsbin.com/mecububepi
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.rawgit.com/lodash/lodash/3.0.1/lodash.min.js"></script>
<meta name="description" content="Exercise Blank">
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
@nakolkin
nakolkin / introrx.md
Created September 24, 2015 21:14 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.