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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / bump-version.sh
Created March 15, 2015 12:56
Bump version shell script.
#!/bin/bash
# Thanks goes to @pete-otaqui for the initial gist:
# https://gist.github.com/pete-otaqui/4188238
#
# Original version modified by Marek Suscak
#
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3" or even "1.2.3-beta+001.ab"
@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)