Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Artem Nikolaienko nakolkin

🏠
Working from home
Block or report user

Report or block nakolkin

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
@nakolkin
nakolkin / sendsqs.js
Created Feb 16, 2018 — forked from understeer/sendsqs.js
AWS Lambda sample: Send received events to SQS as Message
View sendsqs.js
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 Oct 19, 2017 — forked from abn/heredoc-dockerfile.snip
Dockerfile alternatives for heredoc
View heredoc-dockerfile.snip
#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 Jul 17, 2017 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
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 Feb 2, 2016 — 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
View rxDecorateDirective.js
'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];
View browserify_for_webpack_users.markdown

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 Nov 23, 2015 — forked from anonymous/index.html
JS Bin Exercise Blank // source http://jsbin.com/mecububepi
View index.html
<!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 Sep 24, 2015 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md

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.

View .sql
CREATE TABLE summary_v2.campaign_dashboard_daily_v2
(
report_date date NOT NULL,
third_party_adserver_id bigint NOT NULL,
campaign_id bigint NOT NULL,
impression_by_flavor summary_v2.impression[],
impressions_total bigint NOT NULL DEFAULT 0,
uu_impression_total bytea NOT NULL DEFAULT '\000'::bytea,
engagement_by_type summary_v2.engagement[],
engagement_by_flavor summary_v2.engagement[],
View gist:22e4e8dc8e07ebf50375
DROP FUNCTION IF EXISTS summary_v2.get_campaign_placement_currency(bigint, date, date);
CREATE OR REPLACE FUNCTION summary_v2.get_campaign_placement_currency(campaign_id bigint, date_from date, date_to date)
RETURNS TABLE (
currency VARCHAR
) AS
$BODY$
BEGIN
RETURN QUERY
SELECT array_to_string(array_agg( DISTINCT coalesce(pc.iso_code, 'NULL')), ',')::VARCHAR AS currency
View gist:85e07528c56d59919333
SELECT DISTINCT tc.campaign_id, pc.iso_code AS currency
FROM summary_v2.campaign_placement_details_cost_daily_v2 AS daily
INNER JOIN ref_data.tracking_campaign AS tc ON (daily.campaign_id = tc.external_id::BIGINT)
INNER JOIN ref_data.provider AS pr ON (pr.id = tc.tracking_data_provider_id AND pr.tpasns_id = daily.third_party_adserver_id)
LEFT JOIN mdata.placement_currency AS pc ON (pc.tracking_data_provider_id = tc.tracking_data_provider_id AND pc.placement_id = daily.inventory_placement_id)
WHERE summary_v2.empty_to_null(tc.external_id) IS NOT NULL
AND (tc.external_id ~ E'^\\d+$')
AND pr.tpasns_id IS NOT NULL
AND tc.campaign_id IN (23005,23081,22160,22165,22375,22164,23493,22374,22159,22161,22442,22162,22163,25982,26163,26241,28802,27050,26667,27579,28862,26457,28223,26488,26247,26775,30957,33323,28706,27582,34218,41921,41677,33801,34219,40233,39640,33325,43113,41913,40230,40241,42443,47381,52873,47386,47218,48005
You can’t perform that action at this time.