Skip to content

Instantly share code, notes, and snippets.

View mareksuscak's full-sized avatar
🏠
Working from home

Marek Suscak mareksuscak

🏠
Working from home
View GitHub Profile
@mareksuscak
mareksuscak / main.c
Created March 19, 2014 16:38
crc16_update test
#include <stdio.h>
#include <inttypes.h>
uint16_t
crc16_update(uint16_t crc, uint8_t a)
{
int i;
crc ^= a;
for (i = 0; i < 8; ++i)
@mareksuscak
mareksuscak / README.md
Last active August 29, 2015 14:23
RFC: Este.js Part-of-Framework Deployment

Intro

As I mentioned in a comment which is part of the existing este.js deployment issue, we've implemented the application that couldn't be deployed as a node.js server-side app and este.js didn't provide the Part-of-Framework deployment option to deploy it as a static site sitting at the server that serves our backend written in a technology of one's choice (doesn't matter which one). Please note, we don't mind losing all the shiny isomorphic app advantages like the prerendered app returned as a part of the request's response at moment and we know este.js wasn't designed with that in mind. On the other hand este.js dev stack is really one of the best (if not the totally best) out there at the time of writing and that's why we'd like to stick with it.

So I have decided to make the neccessary changes to este.js core myself in our app directly and in a later stage as soon as everything is tested contribute it back to the community. Before d

@mareksuscak
mareksuscak / array.exs
Last active September 1, 2017 21:54
Idiomatic deep flatten implementation in Elixir.
defmodule Array do
def flatten(list), do: flatten(list, [])
def flatten([head | tail], acc) when head == [], do: flatten(tail, acc)
def flatten([head | tail], acc) when is_list(head), do: flatten(tail, flatten(head, acc))
def flatten([head | tail], acc), do: flatten(tail, acc ++ [head])
def flatten([], acc), do: acc
end
@mareksuscak
mareksuscak / maxLightboxWidth.js
Created October 6, 2017 19:59
calculate maximum IG lightbox width given image dimensions
// 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
@mareksuscak
mareksuscak / keybase.md
Created November 1, 2017 02:43
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 / disable-non-sierra.sh
Last active January 25, 2018 16:27
How to Activate MacOS's "Do not Disturb" — shamelessly copied from https://github.com/johnotander/do-not-disturb
# 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
@mareksuscak
mareksuscak / instance_var.re
Created May 27, 2018 20:27
ReasonDojo issues
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 / index.js
Created June 26, 2018 23:46
React Rundown
// 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
@mareksuscak
mareksuscak / README.md
Last active June 27, 2018 00:07
4 Years of React — Lessons Learned

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
@mareksuscak
mareksuscak / Brewfile
Last active August 20, 2019 22:42
Brewfile
tap "homebrew/cask-versions"
tap "homebrew/services"
# Unix
brew "git"
brew "git-lfs"
brew "jq"
brew "yq"
brew "openssl"
brew "thoughtbot/formulae/rcm"