Skip to content

Instantly share code, notes, and snippets.

Fedor Nezhivoi gyzerok

Block or report user

Report or block gyzerok

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

Only have one outgoing port, and only one incoming port

If you have many ports, they could be all over your project, and therefore hard to manage and easy for forget about. Keep track of all of them by representing your outgoing ports in a union type like..

type JsMsg
    = Download
    | Login Login.Payload
    | Logout
    | Track Tracking.Payload
gyzerok /
Created Jan 4, 2018 — forked from evancz/
Cron job to remind myself to stretch

Type crontab -l to see your cron jobs. Type crontab -e to edit them. You have to use Vim apparently.

Add a line like this:

0,30	*	*	*	*	/Users/YOURNAME/Documents/scripts/

That is on every 0th and 30th minute of the hour. Make sure all the separators in there are tabs!


Standardized Ladder of Functional Programming

The LambdaConf Ladder of Functional Programming (LOFP) is a standardized progression of different concepts and skills that developers must master on their journey to becoming expert-level functional programmers. LOFP can be used to rank workshops, talks, presentations, books, and courseware, so that aspiring functional programmers have a better understanding of what material is appropriate for them given their current experience.



  • Immutable Data
  • Second-order Functions
gyzerok /
Last active Aug 14, 2018 — forked from jinjor/
elm-make one by one
# make sure every time only one file is re-compiled
echo "time\t\tlines\timports\tfile"
for f in `find src -name *.elm`
elm-make $f --output=/dev/null > /dev/null
sleep 1
touch $f
a=`wc -l $f | awk '{print $1}'`
View io-ts-reporter.ts
function decode<T>(value: any, type: t.Type<T>): Promise<T> {
const validation = t.validate(value, type);
return validation.fold(
([e, ..._unused]) => {
const actualErr = _.last(e.context);
const errPath = e.context
.map(c => c.key)
.filter(key => key.length)
gyzerok / base64ArrayBuffer.js
Last active Feb 1, 2017 — forked from jonleighton/base64ArrayBuffer.js
Encode an ArrayBuffer as a base64 string
View base64ArrayBuffer.js
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
function base64ArrayBuffer(arrayBuffer) {
var base64 = ''
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
var bytes = new Uint8Array(arrayBuffer)
var byteLength = bytes.byteLength
View stylesheet.elm
stylesheet : String -> Html.Html Msg
stylesheet link =
tag =
attrs =
[ Html.Attributes.attribute "rel" "stylesheet"
, Html.Attributes.attribute "property" "stylesheet"
, Html.Attributes.attribute "href" link
View class-methods-to-properties.js
module.exports = function (fileInfo, api) {
const j = api.jscodeshift;
const root = j(fileInfo.source);
return root.find(j.MethodDefinition)
.filter(method => method.value.kind !== 'constructor')
.replaceWith(method => {
const { key, value: { body, params } } = method.value;
return j.classProperty(
gyzerok /
Created Apr 9, 2016 — forked from evancz/
Some thoughts on how to have nicer discussions online

Towards Discussion Guidelines

I personally like to have discussions in the spirit of the Socratic method. Instead of declaring my opinion, I ask a relevant question. How about this situation? What about this case? This has two possible outcomes.

  1. The other person explains to me how things work in that case. I realize that I misunderstood, and we both come out enriched and in agreement.
  2. The other person realizes that those situations are not covered. They realize they misunderstood, and we both come out enriched and in agreement.

In both cases, it could have been a conflict, egos crashing together. But by asking questions, it becomes a collaboration to find the best answer. Even the simple act of asking a question in the first place says, "I care what you have to say, we can agree on this." That said, I have noticed that it is definitely still possible for things to go wrong within this framework. How can this happen?

There was a passage from [The

gyzerok /
Last active Nov 28, 2016
Thoughts on implementing GraphQL in Elm

GraphQL in Elm

Before going down to some problem statement and requirement I'd like to tell you what makes Elm for me a better choice upon JavaScript and why I moving towards adopting it for productions usage.

I can make some changes in my codebase, run elm-make and see all the places where I should do subsequent changes. Statically. Ave compiler and static types!

The goal of this paper is to describe why proposition of using different types for different queries would result in almost the same pitfalls I have in JavaScript with GraphQL.


You can’t perform that action at this time.