Skip to content

Instantly share code, notes, and snippets.

View willi-dev's full-sized avatar

willi-dev willi-dev

View GitHub Profile
@willi-dev
willi-dev / clean_code.md
Created June 17, 2022 08:11 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@willi-dev
willi-dev / rfc-template.md
Created February 14, 2022 13:20 — forked from michaelcurry/rfc-template.md
RFC Template [Markdown]

RFC Template

Feature Name: (fill me in with a unique identity, myawesomefeature)

Type: (feature, enhancement)

Start Date: (fill me in with today's date, YYYY-MM-DD)

Author: (your names)

@willi-dev
willi-dev / gist:426daac7be2ebf3565db446c2e1e2082
Created February 11, 2022 12:54 — forked from danesparza/gist:1093992
Javascript date range overlap
var e1start = e1.start.getTime();
var e1end = e1.end.getTime();
var e2start = e2.start.getTime();
var e2end = e2.end.getTime();
return (e1start > e2start && e1start < e2end || e2start > e1start && e2start < e1end);
@willi-dev
willi-dev / git-ssh-error-fix.sh
Created December 14, 2021 01:26 — forked from Tamal/git-ssh-error-fix.sh
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@willi-dev
willi-dev / 4k_website_tester.html
Created November 6, 2021 15:55 — forked from jasonhejna/4k_website_tester.html
Test a website in 4k resolution without a 4k monitor
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>4k website tester</title>
<style>
iframe:focus {
outline: none;
}
iframe{
@willi-dev
willi-dev / handling_multiple_github_accounts.md
Created March 17, 2021 06:10 — forked from Jonalogy/handling_multiple_github_accounts.md
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@willi-dev
willi-dev / nginx-tuning.md
Created October 21, 2020 07:43 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@willi-dev
willi-dev / home-template.php
Last active October 4, 2020 05:18
wordpress corigge
<?php
/*
* Template Name: Home
* Author & Copyright: VictorThemes
* URL: https://victorthemes.com
*/
$brixey_id = ( isset( $post ) ) ? $post->ID : 0;
$homepage_layout = get_post_meta( $brixey_id, 'homepage_layout_metaboxes', true );
if ($homepage_layout) {
$home_layout = $homepage_layout['home_layout'];
import React from 'react';
import {storiesOf} from '@kadira/storybook';
import mockRedux from '<path-to>/js/mocks/redux';
import {Component} from '../';
const storeState = {
list: ['foo', 'bar', 'baz'],
someData: {
foo: true,
bar: false
@willi-dev
willi-dev / LegoSetImage.js
Created July 27, 2020 14:16
Redux useSelector and useDispatch hook test example
import React, { FunctionComponent } from "react";
import { useSelector, useDispatch } from "react-redux";
import { selectCurrentSet, zoomImage } from "../dataLayer";
export const LegoSetImage: FunctionComponent = () => {
const set = useSelector(selectCurrentSet);
const dispatch = useDispatch()
const zoomHandler = () => dispatch(zoomImage(set.set_img_url))
return (
<div className="legoSetImageContainer">