Skip to content

Instantly share code, notes, and snippets.

Simon Hanukaev smnh

Block or report user

Report or block smnh

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
smnh / promiseAllPool.js
Created Nov 22, 2017
Promise all with pool of concurrent promises
View promiseAllPool.js
* Like Promise.all(), this method resolves if all promises returned by invoking the "callback" are resolved, or rejects
* if at least one of these promises is rejected. This method ensures that only "poolSize" number of promises are
* executed at the same time. The "total" parameter specifies the number of total promises that need to be executed,
* therefore, the "callback" will be invoked "total" number of times. The "callback" is invoked with a single "index"
* parameter specifying the index of the invocation.
* @example
* let items = [...]
smnh / flattenData.js
Last active Dec 26, 2019
Function for flattening data before indexing it to Elasticsearch (
View flattenData.js
const _ = require('lodash');
module.exports = {
* This function flattens objects by converting them into a flat array of objects having four fields:
* - "key": the path of the field in the original object
* - "type": the type of the field value
smnh / synchronizing-rotation-animation-part-2.m
Last active Jan 31, 2020
Synchronizing rotation animation between the keyboard and the attached view - Part 2
View synchronizing-rotation-animation-part-2.m
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter]
name:UIKeyboardWillChangeFrameNotification object:nil];
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
smnh / synchronized-keyboard-view-rotation-animation-between.m
Last active Aug 29, 2015
Synchronizing rotation animation between the keyboard and the attached view
View synchronized-keyboard-view-rotation-animation-between.m
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification object:nil];
smnh / web-font-loading-detection-without-timers.html
Created Apr 9, 2014
Web font loading detection, without timers
View web-font-loading-detection-without-timers.html
<!DOCTYPE html>
<link href="" rel="stylesheet" type="text/css"/>
<div id="wrapper" style="position:absolute; overflow:hidden;">
<div id="content" style="position:relative; white-space: nowrap; font-family: serif;">
<div id="innerWrapper" style="position:absolute; width:100%; height:100%; overflow:hidden;">
<div id="innerContent"></div>
You can’t perform that action at this time.