Skip to content

Instantly share code, notes, and snippets.

View svschannak's full-sized avatar

Sven Schannak svschannak

View GitHub Profile
@svschannak
svschannak / progressChartVictoryPieStandard.js
Created August 22, 2017 12:29
Progess Chart with Victory Pie
import {VictoryPie, VictoryTheme} from 'victory';
<VictoryPie
padAngle={0}
// used to hide labels
labelComponent={<span/>}
innerRadius={70}
width={200} height={200}
data={[{'key': "", 'y': this.state.metric}, {'key': "", 'y': (100-this.state.metric)} ]}
colorScale={["#19B3A6", "#EEEEEE" ]}
@svschannak
svschannak / progressChartVictoryPieWithText.js
Created August 22, 2017 12:37
Progess Chart with Victory Pie and Text in the center of the pie chart
<svg width={200} height={200}>
<text x={100} y={110} textAnchor="middle" >
{this.state.metric}%
</text>
<VictoryPie
padAngle={0}
// used to hide labels
labelComponent={<span/>}
innerRadius={70}
width={200} height={200}
@svschannak
svschannak / gist:8d1a445a751d5ae8e18ef9b98a45be9f
Last active June 26, 2019 08:48 — forked from guilherme/gist:9604324
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='^\+.*console\.log('
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then
@svschannak
svschannak / install_nativefier.sh
Created December 5, 2017 15:59
Install Nativefier
npm install nativefier -g
@svschannak
svschannak / nativefier_gdrive.sh
Created December 5, 2017 16:02
Google Drive mit Nativefier aufsetzen
nativefier --name "Google Drive" "https://drive.google.com/drive/recent"
@svschannak
svschannak / docker-compose.yml
Created February 26, 2018 21:02
Docker Compose file for Parse.js
version: '3'
services:
mongo-parse-server:
image: mongo
ports:
- 27017:27017
parse-server:
image: parseplatform/parse-server
links:
- mongo-parse-server
@svschannak
svschannak / vat_validation.js
Created March 6, 2018 15:20
VAT ID Validation
/*==================================================================================================
Application: Utility Function
Author: John Gardner
Website: http://www.braemoor.co.uk/software/vat.shtml
Version: V1.0
Date: 30th July 2005
Description: Used to check the validity of an EU country VAT number
@svschannak
svschannak / react_error_boundaries.jsx
Created March 20, 2018 07:25
Error Boundaries in React
import React from 'react';
import MyGreatComponent from './my-component';
class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
componentDidCatch(error, info) {
@svschannak
svschannak / flatten_array_with_tests.js
Last active April 13, 2018 10:24
Array flattener
// You can test it in the browser here: https://codepen.io/svschannak/pen/KoLZvm?editors=0011
// try to avoid using const and arrow functions to declare an function, it will help you while debugging
function flatten_array(originList){
/**
* Flattens an input list with multi levels.
* WORKS only with ES6
* Description. (use period)
* @param {Array[List]} originList Array List to be flattened.
*
* @return {Array[List]} New flattened array list.
@svschannak
svschannak / install_dokku.sh
Created June 28, 2018 09:52
Install for dokku
wget https://raw.githubusercontent.com/dokku/dokku/v0.12.10/bootstrap.sh
sudo DOKKU_TAG=v0.12.10 bash bootstrap.sh