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 / 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 / Bundler.md
Last active January 18, 2020 12:28
Bundler alternatives

Bundler investigation

Nested currently uses webpack as its bundler of choice for its front-end projects. This is a community norm, but has some drawbacks that lead to a strictly timeboxed investigation of an alternative.

Why investigate alternatives?

Webpack is best known for bundling JavaScript files, however it also has an extensive system for plugins, loaders, and general configuration that can make it an incredibly flexible tool.

Flexibility is not without cost, however, which primarily manifests in time required to understand and maintain the webpack configuration. As many engineers at Nested are still becoming comfortable in the modern front-end ecosystem, adding an understanding of webpack complexity removes time that could be spent developing features that deliver customer value.

This particular investigation sprung from spending time with the team reviewing a 21 day old PR to upgrade webpack from 3 to 4, which highlighted time invested in the tool.

@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 / 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,