Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Marek Suscak mareksuscak

🏠
Working from home
Block or report user

Report or block mareksuscak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mareksuscak
mareksuscak / grafana-redis-exporter-dashboard-by-pod.json
Created Sep 26, 2019
Redis Exporter 1.x Dashboard for Grafana (breakdown by pod instead of an IP)
View grafana-redis-exporter-dashboard-by-pod.json
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prom",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@mareksuscak
mareksuscak / messenger.yaml
Created Sep 11, 2019
Symfony 4.4 Messenger - Alternative approach to different middleware for producer and consumer
View messenger.yaml
framework:
messenger:
# ...
# Read more to learn why there are two buses (TL;DR: different middleware on each side - producer and consumer)
# https://github.com/symfony/symfony/issues/32436#issuecomment-530565499
default_bus: command.bus
buses:
command.bus:
@mareksuscak
mareksuscak / AddConsumerBusNameStampMiddleware.php
Last active Sep 11, 2019
Symfony 4.4 Messenger - Different middleware on the consumer and producer side
View AddConsumerBusNameStampMiddleware.php
<?php
namespace App\Messenger\Middleware;
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
use Symfony\Component\Messenger\Middleware\StackInterface;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Stamp\BusNameStamp;
# This is sort of a workaround, read more here:
View Brewfile
tap "homebrew/cask-versions"
tap "homebrew/services"
# Unix
brew "git"
brew "git-lfs"
brew "jq"
brew "yq"
brew "openssl"
brew "thoughtbot/formulae/rcm"
@mareksuscak
mareksuscak / README.md
Last active Jun 27, 2018
4 Years of React — Lessons Learned
View README.md

4 Years of React — Lessons Learned

Design

  • Use wireframes as a visual aid for breaking UIs down into components
  • Have a design system in place and stick to it strictly
  • Involve the designer in creating a design system of components
  • Use sane CSS architecture — CSS modules w/ BEVM combined w/ utility first CSS
View index.js
// JSX
<div/> // React.createElement('div')
<Component/> // React.createElement(Component)
<div>Message</div> // React.createElement('div', null, 'Message')
<Parent><Child/></Parent> // React.createElement(Parent, null, React.createElement(Child))
<div>{value}</div> // React.createElement('div', null, value)
<div
View instance_var.re
let a = 1;
/**
* Results in "Error. The value a is not an instance variable"
* But what if the person is just learning about Reason and has no idea what an instance variable is?
* Perhaps saying it's immutable would be a better idea? IDK
*/
a = 2;
@mareksuscak
mareksuscak / disable-non-sierra.sh
Last active Jan 25, 2018
How to Activate MacOS's "Do not Disturb" — shamelessly copied from https://github.com/johnotander/do-not-disturb
View disable-non-sierra.sh
# Disable DND on non-Sierra
osascript >/dev/null <<'END'
tell application "System Events"
tell application process "SystemUIServer"
try
if exists menu bar item "Notification Center, Do Not Disturb enabled" of menu bar 2 of application process "SystemUIServer" of application "System Events" then
key down option
click menu bar item "Notification Center, Do Not Disturb enabled" of menu bar 2
key up option
end if
View keybase.md

Keybase proof

I hereby claim:

  • I am mareksuscak on github.
  • I am mareksuscak (https://keybase.io/mareksuscak) on keybase.
  • I have a public key whose fingerprint is 75EE 8C1D 5095 52F0 C536 DA56 02C3 616D 6178 D603

To claim this, I am signing this object:

@mareksuscak
mareksuscak / maxLightboxWidth.js
Created Oct 6, 2017
calculate maximum IG lightbox width given image dimensions
View maxLightboxWidth.js
// Constants
const MAX_PLACEHOLDER_WIDTH = 640
const MAX_PLACEHOLDER_HEIGHT = 640
const SIDEBAR_WIDTH = 320
function calcPlaceholderWidth(imageWidth, imageHeight) {
const aspectRatio = imageHeight / imageWidth
let placeholderWidth
You can’t perform that action at this time.