Skip to content

Instantly share code, notes, and snippets.

View mimol91's full-sized avatar

Adam Szaraniec mimol91

View GitHub Profile
@mimol91
mimol91 / rest.js
Created September 12, 2016 19:21
rest
import rest from 'rest'
import hateoas from 'rest/interceptor/hateoas'
import mime from 'rest/interceptor/mime'
import interceptor from 'rest/interceptor'
import defaultRequest from 'rest/interceptor/defaultRequest'
import errorCode from 'rest/interceptor/errorCode'
const tokenRemoval = interceptor({
response: (response, config, meta) => {
if (response.status.code === 401) {
@mimol91
mimol91 / README.MD
Last active September 18, 2016 20:40
HAL + SPA

HAL + SPA

Technology
  • React - A JavaScript library for building user interfaces
  • Redux - RESTful HTTP client for JavaScript
  • Rest - Predictable state container for JavaScript apps

Introduction

React containers should be self aware and be able to fetch required data to pass it to components. Using HAL may cause to send multiple request to obtain this same data. This document shows possible solutions how this can be solved.

@mimol91
mimol91 / map rand.js
Last active November 23, 2016 10:43
map rand
const shipConfig = [
[4],
[3],
[2],
[1],
[1],
[1],
[1]
];
@mimol91
mimol91 / docker.sh
Created March 26, 2017 15:26
docker
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@mimol91
mimol91 / circle.yml
Created December 12, 2018 13:50 — forked from azihsoyn/circle.yml
example circleci 2.0 with go 1.10
version: 2
jobs:
build:
working_directory: /go/src/github.com/your_company/your_app
docker:
- image: circleci/golang:1.10.0
environment:
- GOCACHE: "/tmp/go/cache"
- DEP_VERSION: 0.4.1
steps:
@mimol91
mimol91 / combinators.js
Created December 12, 2018 17:38 — forked from Avaq/combinators.js
Common combinators in JavaScript
const I = x => x;
const K = x => y => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));

When Istio Meets Jaeger - An Example of End-to-end Distributed Tracing

Kubernetes is great! It helps many engineering teams to realize the dream of SOA (Service Oriented Architecture). For the longest time, we build our applications around the concept of monolith mindset, which is essentially having a large computational instance running all services provided in an application. Things like account management, billing, report generation are all running from a shared resource. This worked pretty well until SOA came along and promised us a much brighter future. By breaking down applications to smaller components, and having them to talk to each other using REST or gRPC. We hope expect things will only get better from there but only to realize a new set of challenges awaits. How about cross services communication? How about observability between microservices such as logging or tracing? This post demonstrates how to set up OpenTracing inside a Kubernetes cluster that enables end-to-end tracing between serv

func Questions(p graphql.ResolveParams) (interface{}, error) {
resolver := NewResolver(&p, producer.Producer)
err, subscriber := resolver.SendEvent(topic.QuestionnaireTopicName, &protobuf.Message{
Locale: "en-US",
Topic: topic.QuestionnaireTopicName,
Type: proc.List,
Payload: protobuf.CreateQuestionnaire(&questionnaire.QuestionnairePayload_List{
List: &questionnaire.List{
Bucket: "default",
@mimol91
mimol91 / optimise-images-terminal.md
Created May 14, 2019 07:49 — forked from gielcobben/optimise-images-terminal.md
Optimise your pngs from the terminal in OSX

JPG:
$ brew install jpegoptim
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;

- PNG:
$ brew install optipng
$ find . -name "*.png" -exec optipng -o7 {} \;

@mimol91
mimol91 / resp.js
Last active July 30, 2019 11:24
resp
data = {
"state":{
"counter":2
},
"bindings": {
onClickButton : ({navigation}, setState) => () => {
setState((state) => ({counter: state.counter + 1}))
//setState({counter: 5})
setTimeout(()=>{
navigation.navigate('Home')