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