Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
if [ "$(getent hosts host.docker.internal)" = "" ]; then
ip=$(getent hosts docker.for.mac.localhost docker.for.win.localhost docker.for.linux.localhost | awk '{print $1}')
if [ "${ip}" = "" ]; then
ip=$(ip -4 route list match 0/0 | awk '{print $3}')
fi
echo -e "${ip}\thost.docker.internal\n" | tee -a /etc/hosts > /dev/null
git cherry-pick a87a893
# exclude commit 9083c92
git cherry-pick 898b831
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TEST</title>
<link as="script" href="/main.js" rel="preload">
</head>
<body>
const raceAgainst = (fn, timeout) => new Promise((resolve, reject) => {
const timer = setTimeout(() => {
resetTimer()
resolve(false)
}, timeout)
const resetTimer = () => timer && clearTimeout(timer)
const asyncFn = async () => {
try {
@EnoahNetzach
EnoahNetzach / createReducer.js
Created September 8, 2016 22:17
redux utility for creating reducers reusing the same fn for multiple actions Raw
const noOp = a => a
const createReducer = initialState => {
const storedReducers = {}
const resolveReducer = (state, action) => (typeof state === 'undefined'
? initialState
: (storedReducers[action.type] || noOp)(state, action)
)
@EnoahNetzach
EnoahNetzach / Form.js
Created August 21, 2016 14:59
redux-form v5 ArrayField fixer
import React, { PropTypes } from 'react'
import { reduxForm } from 'redux-form'
import fieldArrayFixer from './fieldArrayFixer'
const applyTo = fn => (...args) => () => fn(...args)
export const fields = [
'shipping.street',
'shipping.city',
'shipping.phones[]',
<style type="text/css">
code {
color: inherit;
background-color: inherit;
}
.empty_literal_bit {
color: #333;
}
.active_bit,
.active_literal_bit,
#include <iostream>
#include <memory>
#include <utility>
#include <limits>
#include <stack>
#include <vector>
#include <stdexcept>
#include <map>
#include <string>
#include <boost/tuple/tuple.hpp>
@EnoahNetzach
EnoahNetzach / main.cpp
Last active December 16, 2015 10:08
C++ multiple interfaces
/*
* main.cpp
*
* Created on: Apr 19, 2013
* Author: Enoah Netzach
*
* Description: manages multiple interfaces in separated, single threads.
*
* Usage:
* 1) in Interface_base create your own signaling fields