- Jim Weirich: The Building Blocks of Modularity – http://goo.gl/g4Nk
- Jim Weirich: SOLID Ruby – http://goo.gl/z3jd
- Sandi Metz: SOLID Object-Oriented Design – http://goo.gl/PDn6T
- Sandi Metz: Less – The Path to Better Design – http://goo.gl/VuTl4
- Demeter is for Encapsulation – http://is.gd/eeyLx
- Opinionated Modular Code – http://is.gd/eeyXm
- Scaling to Hundreds of Millions of Requests – http://vimeo.com/12814529
- Confident Code – http://goo.gl/VFLX
- Destroy All Software Screencasts – https://www.destroyallsoftware.com/screencasts
- Corey Haines: Fast Rails Tests – http://goo.gl/Va2gb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------------------- | |
# Eller's algorithm for maze generation. Novel in that it only | |
# requires memory proportional to the size of a single row; this means | |
# you can generate "bottomless" mazes with it, that just keep going | |
# and going and going, using not only constant memory, but little | |
# memory in general. | |
# -------------------------------------------------------------------- | |
# -------------------------------------------------------------------- | |
# 1. Allow the maze to be customized via command-line parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
module RedBlackTree where | |
data Zero | |
data Succ n | |
type One = Succ Zero | |
data Black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Pick the right ones, and programming will flow naturally from design; | |
modules will have small and simple interfaces; and new functionality will | |
more likely fit in without extensive reorganization. | |
Pick the wrong ones, and programming will be a series of nasty surprises: | |
interfaces will become baroque and clumsy as they are forced to accommodate | |
unanticipated interactions, and even the simplest of changes will be hard to make." | |
MIT Professor Daniel Jackson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A queue that you can pass to IO.select. | |
# | |
# NOT THREAD SAFE: Only one thread should write; only one thread should read. | |
# | |
# Purpose: | |
# Allow easy integration of data-producing threads into event loops. The | |
# queue will be readable from select's perspective as long as there are | |
# objects in the queue. | |
# | |
# Implementation: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ------------------------------------------------------- | |
# @author X4 | |
# @version 1.0 | |
# | |
# HowTo: | |
# You can add a new GlobalHotkey to the media forward an back buttons for example. | |
# There are other ways to run this script: Button or Keypresses, Plasmoids, Events.. | |
# | |
# Use these parameters when on XFCE for example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -t 0 ]; then | |
if [ -z "$1" ]; then | |
echo "usage: tny long_url [custom_keyword]" | |
echo "" | |
echo "Shorten URLs with tny.im URL shortener" | |
echo "This script expects a long URL to shorten either as an argument or passed through STDIN." | |
echo "When using arguments, an optional second argument can be provided to customize the later part of the short URL (keyword)." | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ConstraintKinds, DataKinds, PolyKinds, TypeFamilies, TypeOperators #-} | |
import GHC.Exts (Constraint) | |
type family Restrict (a :: k) (as :: [k]) :: Constraint where | |
Restrict a (a ': as) = ("Error!" ~ "Tried to apply a restricted type!") | |
Restrict x (a ': as) = Restrict x as | |
Restrict x '[] = () | |
foo :: Restrict a [(), Int] => a -> a |
OlderNewer