Skip to content

Instantly share code, notes, and snippets.

View rgm's full-sized avatar

Ryan McCuaig rgm

View GitHub Profile
@isaacsanders
isaacsanders / Equity.md
Created January 21, 2012 15:32
Joel Spolsky on Equity for Startups

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju

@devn
devn / numbers-to-english.clj
Created January 27, 2012 22:31
numbers to english in clojure
(ns quiz.core
(:require [clojure.pprint :as pp]))
(defn to-english [n]
(pp/cl-format nil "~@(~@[~R~]~^ ~A.~)" n))
(to-english 99999999999999999)
;=> "Ninety-nine quadrillion, nine hundred ninety-nine trillion, nine hundred ninety-nine billion, nine hundred ninety-nine million, nine hundred ninety-nine thousand, nine hundred ninety-nine"
(map to-english (range 0 101))
@henrik
henrik / rules.md
Last active May 23, 2022 12:31
Sandi Metz' four rules from Ruby Rogues episode 87. Listen or read the transcript: http://rubyrogues.com/087-rr-book-clubpractical-object-oriented-design-in-ruby-with-sandi-metz/
  1. Your class can be no longer than 100 lines of code.
  2. Your methods can be no longer than five lines of code.
  3. You can pass no more than four parameters and you can’t just make it one big hash.
  4. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.

You can break these rules if you can talk your pair into agreeing with you.

@rgm
rgm / gist:e670f333ae91553031a8
Last active November 10, 2023 21:33
FizzBuzz in the untyped λ-calculus, as approximated by Ruby stabby procs. courtesy of @tomstuart.
-> k { -> f { -> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }]
} [-> f { -> l { -> x { -> g { -> b { b }[-> p { p[-> x { -> y { x } }]
}[l]][x] [-> y { g[f[-> l { -> p { p[-> x { -> y { y } }] }[-> p { p[-> x { ->
y { y } }] } [l]] }[l]][x][g]][-> l { -> p { p[-> x { -> y { x } }] }[-> p {
p[-> x { -> y { y } }] }[l]] }[l]][y] }] } } } }][k][-> x { -> y { -> f {
f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> l { -> x { -> l {
-> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { ->
f { f[x][y] } } } [x][l]] } }[l][f[x]] } }] } }[-> f { -> x { f[-> y { x[x][y]
}] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { ->
n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n {
@mike-thompson-day8
mike-thompson-day8 / dnd.cljs
Last active February 7, 2018 00:43
DnD example for re-com
;; What you are looking at: I just picked up this code from one of our apps, and dumped it here unedited.
;; It shows how to do DnD with reagent/re-com, using the terrible HTML5 API.
;; I haven't done anything to shrink this code down. It is a straight cut and paste from live code
;; so it is complicated by many real world, application issues, sorry. It is also very early
;; code for us, on coming to cljs, so it probably contains all sorts of ugly and embarasing attrocities.
;; But it does work.
;; So, as background, when trying to understand what the code is doing, imagine a panel containing
;; a "table" of rows. Each row displays "a single daypart" item (it doesn't matter what a daypart is)
@pesterhazy
pesterhazy / building-sync-systems.md
Last active July 13, 2024 00:22
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@mfikes
mfikes / concurrency.clj
Last active June 7, 2024 18:33
Concurrency comparison Swift async/await and Clojure core.async
(require '[clojure.core.async :refer [go <!]])
(defn fetch-user-id [server]
(go
(if (= server "primary")
97
501)))
(defn fetch-username [server]
(go