Blog 2019/1/25
<- previous | index | next ->
Browsing solutions to the same problem is a great way to compare languages!
// Porting of https://gist.github.com/jdegoes/dd66656382247dc5b7228fb0f2cb97c8 | |
typealias UserID = String | |
data class UserProfile(val name: String) | |
// The database module: | |
interface DatabaseService { | |
suspend fun dbLookup(id: UserID): UserProfile | |
suspend fun dbUpdate(id: UserID, profile: UserProfile) | |
} |
#!/bin/bash | |
DAYS_SINCE_LAST_CHANGE=14 # If a project hasn't been touched in this long its node_modules will be deleted | |
SEARCH_PATH="./Git" # Update this to the path where your code is stored | |
TOTAL_BYTES_REMOVED=0 | |
Mb=1000000 | |
Kb=1000 | |
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune) |
import { useEffect, useRef } from 'react'; | |
export const useEventEmitter = (eventEmitter, eventName: string, fn: () => void) => { | |
const subscription = useRef(null); | |
useEffect(() => { | |
subscription.current = eventEmitter.addListener(eventName, fn); | |
return () => { | |
if (subscription.current) { |
type update('state, 'action) = | |
| NoUpdate | |
| Update('state) | |
| SideEffects(self('state, 'action) => unit) | |
| UpdateWithSideEffects('state, self('state, 'action) => unit) | |
and self('state, 'action) = { | |
state: 'state, | |
send: 'action => unit, | |
}; |
const { | |
isFetchingEnd, | |
isFetchingTop, | |
onRefresh, | |
onEndReached, | |
} = useRelayPagination(relay, users); | |
const isRefreshing = isFetchingEnd || isFetchingTop; | |
<FlatList |
module Data.Labelled.Tree where | |
-- Traditionally, we express a rose tree with a structure along the lines of | |
-- | |
-- ``` | |
-- data RoseTree a | |
-- = RoseTree a (Array (RoseTree a)) | |
-- ``` | |
-- | |
-- As with many of our favourite "Haskell containers", this comes with an |
Blog 2019/1/25
<- previous | index | next ->
Browsing solutions to the same problem is a great way to compare languages!
https://twitter.com/snookca/status/1073299331262889984?s=21
Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows.
(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)
So the big deal about css-in-js (cij) is selectors.
#!/usr/local/bin/python3 | |
import os | |
import subprocess | |
import json | |
from os.path import expanduser | |
home = expanduser("~") | |
track = 'reasonml' | |
projects = ['protein-translation', 'armstrong-numbers', 'change', 'rna-transcription', 'space-age', 'bob', 'anagram', 'accumulate', 'run-length-encoding', 'minesweeper', 'hello-world', 'leap', 'isogram', 'raindrops', 'acronym', 'word-count', 'allergies', 'all-your-base', 'pangram', 'binary-search'] |