Skip to content

Instantly share code, notes, and snippets.

View Tymek's full-sized avatar

Tymoteusz Czech Tymek

View GitHub Profile
@Tymek
Tymek / magnus.tsx
Created November 6, 2020 09:20
Magnus tsx but prettier
import * as React from "react";
import { StyleSheet, SafeAreaView } from "react-native";
import {
Div,
ThemeProvider,
Text,
Button,
Input,
Icon,
Image,
@Tymek
Tymek / tricky-but-important.js
Created July 27, 2020 16:20
tricky-but-important.js
typeof (() => { return })()
@Tymek
Tymek / machine.js
Last active May 21, 2020 21:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@Tymek
Tymek / rule.js
Last active December 28, 2019 20:38
Auth0 rule for JWT Hasura roles
function (user, context, callback) {
// console.log('context', context);
const namespace = "https://hasura.io/jwt/claims";
const roles = (context.authorization || {}).roles || [];
const claims = {
'x-hasura-default-role': 'user',
'x-hasura-allowed-roles': [
'anonymous',
'user',
@Tymek
Tymek / compose.log
Last active July 22, 2019 20:14
FusionAuth Docker
Attaching to fusionauth_fusionauth_1, fusionauth_db_1, fusionauth_search_1
fusionauth_1 | mkdir: cannot create directory '/usr/local/fusionauth/fusionauth-app/apache-tomcat/../../logs': Permission denied
fusionauth_1 | 22-Jul-2019 19:29:14.550 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Server} Setting property 'port' to '${fusionauth.management.port}' did not find a matching property.
fusionauth_1 | 22-Jul-2019 19:29:15.444 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'port' to '${fusionauth.http.port}' did not find a matching property.
fusionauth_1 | 22-Jul-2019 19:29:15.451 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'redirectPort' to '${fusionauth.https.port}' did not find a matching property.
fusionauth_1 | 22-Jul-2019 19:29:15.846 WARNING [main] org.apache.catalina.startup
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
allow-hotplug ens4
iface ens4 inet dhcp
# "Failover"
auto ens3:0
@Tymek
Tymek / unusedActionTypes.js
Last active May 2, 2019 10:51
Find unused action types in Redux stores. no eslint rule for that :| easy to miss during actionTypes refactoring
#!/usr/bin/env node
const fs = require('fs')
const isWin = process.platform === "win32";
const findCmd = isWin ? 'dir /s *store.js' : 'find src -name "*store.js"'
const exec = require('child_process').exec
const findStores = () => new Promise((resolve, reject) => {
exec(
@Tymek
Tymek / isOverlaping.js
Last active March 6, 2019 19:34
Time/date (timestamps) segments overlap in Ramda
/**
* @see: https://gist.github.com/Tymek/10282cfecebdc16c962baf98e0314a57
*/
const {
apply,
compose,
lt,
max,
min,
@Tymek
Tymek / .gitlab-ci.yml
Last active March 1, 2023 10:08
Static files server build for NodeJS→GitLab CI→Docker→Nginx pipeline
image: alpine
cache:
paths:
- node_modules/
before_script:
- DIST_DIR=$([ "$DIST_DIR" ] || echo "./dist")
stages:
@Tymek
Tymek / server.sh
Last active February 13, 2019 00:42 — forked from jrnickell/serve-static
Simple static files server with Python in Docker
docker run \
-v $(pwd):$(pwd) \
-w $(pwd) \
-p 0.0.0.0:80:80 \
-it --rm --name="python-http-server" python:3 python \
-m http.server 80