Skip to content

Instantly share code, notes, and snippets.

View MarcelCutts's full-sized avatar
💭
git push -f origin main

Marcel Cutts MarcelCutts

💭
git push -f origin main
View GitHub Profile
@MarcelCutts
MarcelCutts / classic_func_compare.py
Last active August 29, 2015 14:06
Comparing classic with functional approaches to looking
# Print the top board markers
# Starting with a space and climbing alphabetically
# Classic method
current_row = "A"
top_line = " "
for column in self.grid[0]:
top_line += current_row + " "
current_row = chr(ord(current_row)+1)
print top_line
@MarcelCutts
MarcelCutts / Readability comparision - dict comprehension
Created April 7, 2015 20:39
Difference in readability of dict comprehension vs more verbose by simpler loops
def get_time_to_work(property, house_member):
"""
Calculates time taken to get to work for a particular
house member if they were to live at a particular property
:param property: Property to travel to and from
:param house_member: House member details
:return: A series of commute times
"""
commute_times = {}
for travel_mode in house_member['allowed_travel_methods']:
@MarcelCutts
MarcelCutts / RNResponse.md
Last active February 21, 2016 19:53
Difficulties and suggestions for React-Native docs

Difficulties and suggestions around a newbie using React-Native 0.20

This is a response to a chap on twitter asking about possible improvements to prevent having to 'treasure hunt' knowledge to make React-Native work.

I am primarily a full stack web guy, with some hardware and app experience from overseeing "Zombies, Run". What did and didn't work for me may not be applicable to others!

Documentation shortcomings

The official docs are brief and have a number of shortcomings that required me to fill in gaps in knowledge, either via experimentation or through trawling internet forums.

@MarcelCutts
MarcelCutts / terrible_fetch.ml
Created September 18, 2017 23:21
A super hacky attempt to get async fetching working on button press.
open Bs_fetch;
let sj json :list string => Json.Decode.(json |> list string);
type remoteData 'e 'a =
| NotAsked
| Loading
| Failure 'e
| Success 'a;

Keybase proof

I hereby claim:

  • I am marcelcutts on github.
  • I am marcelc (https://keybase.io/marcelc) on keybase.
  • I have a public key ASAOW2f941bqy_CBbdEcji1S_IXvA0fvOA9IsbVf3_WKwgo

To claim this, I am signing this object:

@MarcelCutts
MarcelCutts / erlang variables
Created July 16, 2018 11:48
Enable erlang to compile with asdf
export CC=clang CXX=clang CFLAGS="-g -O3 -fstack-protector" LDFLAGS="-fstack-protector" KERL_CONFIGURE_OPTIONS="--disable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --enable-darwin-64bit --with-ssl=/usr/local/opt/openssl
@MarcelCutts
MarcelCutts / WithStateRecompose.re
Created August 1, 2018 19:09
Incrementor with HOC
type hoc = ReasonReact.reactClass => ReasonReact.reactClass;
module type CreateWithStateParams = {type state; let defaultValue: state;};
module CreateWithState = (Params: CreateWithStateParams) => {
[@bs.module "recompose"]
external withState : (string, string, Params.state) => hoc = "withState";
type setState = Params.state => unit;
type children =
@MarcelCutts
MarcelCutts / TS.md
Created July 25, 2018 13:23
A list of findings after experimenting with TypeScript

TypeScript

TypeScript (TS) is a language that promises "JavaScript that scales". After running a number of investigationary projects, TS has been found lacking for a number of reasons that can be summarised in the following categories.

  1. Configuration
  2. Permissiveness
  3. Strict mode
  4. Lock-in
  5. Progressive inclusion
@MarcelCutts
MarcelCutts / Blob.re
Last active August 27, 2018 15:18
Theming problems
let component = ReasonReact.statelessComponent("Blob");
type maxWidth = {
small: string,
large: string,
};
type typography = {
light: int,
bold: int,
@MarcelCutts
MarcelCutts / goodjs.md
Created October 22, 2018 10:31
Good JS

Guide to creating and reviewing a JavaScript PR.

JavaScript (JS) continues to devour an ever increasing portion of the software universe. It has a forgiving nature and few restrictions - allowing nearly anyone to get started with few requirements to understand complex programming concepts.

However, this trait becomes challenging when the need to manage the complexity of intricate JS applications arises, as those tools and paradigms aren’t baked into the language and standard toolchains. This leaves use leaning on tools and practices instead.

You’ll likely have to create and review JS as part of your day to day. Below is some guidance on what to look for in a PR and keeping master green.

Core concepts