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
jinjor /
Last active Sep 15, 2017
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}'`

The Why and When of Choosing Elm

What is Elm?

  • Language (and "framework") for building web frontend applications
  • Can be used in place of HTML, CSS and JavaScript
  • Compiles into the above
View InputWithAddAction.elm
module InputWithAddAction (Model, Action, view, update, init) where
import Html exposing (div, input, button, text)
import Html.Events exposing (onClick, on, targetValue)
import Html.Attributes exposing (value)
import Signal
type Action = UpdatedValue String
sebmarkbage / Enhance.js
Last active Mar 15, 2020
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
componentDidMount() {
this.setState({ data: 'Hello' });
render() {
kevinold / immutable-js-flux-store.js
Created Jan 31, 2015
Immutable Flux Store example from Lee Byron (@leeb) from his React.js Conf 2015 talk
View immutable-js-flux-store.js
var Immutable = require('immutable');
var todos = OrderedMap();
var TodoStore = createStore({
getAll() { return todos; }
Dispatcher.register(function(action) {
if (action.actionType === "create") {
var id = createGUID();
Bacon = require('baconjs')
Imm = require('immutable')
React = require('react')
window.Actions =
changeFirstName: new Bacon.Bus()
changeLastName: new Bacon.Bus()
changeCountry: new Bacon.Bus()
addCountryBird: new Bacon.Bus()
addFriend: new Bacon.Bus()
evancz /
Last active Oct 10, 2018
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

You can’t perform that action at this time.