Skip to content

Instantly share code, notes, and snippets.

🤔
feel creative

Eugene Krevenets hyzhak

🤔
feel creative
Block or report user

Report or block hyzhak

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
@hyzhak
hyzhak / component.js
Created Jan 15, 2019
track frequent component diff v0.1
View component.js
/**
* try to track frequent component update without real neads of update
*/
//...
componentDidUpdate (prevProp) {
console.log('componentDidUpdate ',
this.props.collectionId,
'\ndiff:\n',
Object.entries(prevProp)
.filter(([key, value]) => value !== this.props[key])
@hyzhak
hyzhak / next-tick.js
Created Nov 30, 2018
next tick promise build which could be used when we need to wait before next portion of async calls
View next-tick.js
/**
* Create next trick promise which could be used:
*
* lazyAction()
* .then(nextTick())
* .then(doSomethingElse)
*
* @returns {Promise}
*/
module.exports = () => new Promise(resolve => process.nextTick(resolve))
@hyzhak
hyzhak / get-namespace.js
Created Nov 14, 2018
get current app redux namespace
View get-namespace.js
import packageJSON from '../../package'
/**
* get current app namespace
*/
module.exports = function getReduxNamespace () {
return packageJSON.name
}
@hyzhak
hyzhak / perf.js
Created Nov 9, 2018
short but useful function to measure performance of function in node.js
View perf.js
function perf(fn) { console.time('x'); fn(); console.timeEnd('x');}
@hyzhak
hyzhak / show_samples.py
Last active Nov 8, 2018
Convert tensorflow dataset to pandas dataframe
View show_samples.py
import pandas as pd
import tensorflow as tf
def convert_tf_to_pd(ds, limit=32):
"""
Read data from Tensorflow dataset to Pandas dataframe
:param ds:
:param limit:
@hyzhak
hyzhak / binary.js
Last active Sep 13, 2018
limitations of binary operations in js
View binary.js
// Binary shifting
1 << 30
// 1073741824
1 << 31
// -2147483648
1 << 32
// 1
// Power
@hyzhak
hyzhak / Dockerfile
Created Jul 20, 2018
FoundationDB and Python3 together in the one Docker container
View Dockerfile
FROM foundationdb:ubuntu-18.04
# for the moment it is not published
# current version in preview here:
# https://github.com/apple/foundationdb/pull/355
ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
@hyzhak
hyzhak / links.md
Last active Oct 5, 2018
Awesome List of NASA Space Apps Challenge 2017
View links.md
@hyzhak
hyzhak / my-form.ts
Last active Dec 14, 2016
enable/disable group of elements on input[radio] selected for angular 2 with reactive forms (ReactiveFormsModule)
View my-form.ts
//angular 2 (TypeScript, ReactiveFormsModule)
export class MyForm {
form: FormGroup;
constructor(fb: FormBuilder) {
this.form = fb.group({
radioInput: '',
group1: fb.group({
ctr0: '',
ctr1: '',
@hyzhak
hyzhak / async_stories.py
Last active Sep 3, 2016
architecture of stories - stateless and async
View async_stories.py
"""
v0.1.0
Bot asks user about destionation of space travelling.
- stateful story, it stores context of story (current question) in python interpreter
"""
@story.once('lets go!')
async def async_story(message):
dest = await ask_location(message['user'], text='Where do you go?')
store_destination(dest['location'])
You can’t perform that action at this time.