Skip to content

Instantly share code, notes, and snippets.

Umair Saeed umairsd

Block or report user

Report or block umairsd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View types.markdown

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

View Capture.swift
import UIKit
import XCPlayground
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
func perform(initial: Int) {
var value: Int = initial
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1), dispatch_get_main_queue()) { [myConstant = value] in
print("constant in first block \(myConstant)")
print("captured \(value)")
value = initial * 2
bishboria /
Last active Dec 8, 2019
Springer made a bunch of books available for free, these were the direct links
umairsd / miscellaneous.hs
Created Oct 3, 2015
General purpose Haskell functions
View miscellaneous.hs
-- a function that's equivalent to the standard library's sequence function
myseq ms = foldr k ([[]]) ms
where k m m' = [x:xs | x <- m, xs <- m']
-- another variant of the sequence function, uses return [] instead of [[]]
myseq1 ms = foldr k (return []) ms
where k m m' = [x:xs | x <- m, xs <- m']
View TreeZipper.hs
-- A Tree is either empty, or a node containing data of type a, and two other trees
data Tree a = Empty | Tree a (Tree a) (Tree a)
-- Create a leaf node, a tree with no children
leaf :: a -> Tree a
leaf x = Tree x Empty Empty
left :: Tree a -> Tree a
left Empty = Empty
left (Tree _ l _) = l
View gist:44b7063110fc423edb4d

Things that programmers don't know but should

(A book that I might eventually write!)

Gary Bernhardt

I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.

Ashton-W / Breakpoints_v2.xcbkptlist
Last active May 19, 2019
My User Breakpoints_v2.xcbkptlist
View Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
type = "2"
version = "2.0">
<!-- All Exceptions -->
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
jboner / latency.txt
Last active Dec 13, 2019
Latency Numbers Every Programmer Should Know
View latency.txt
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
p01 / LICENSE.txt
Last active Jun 26, 2019 — forked from 140bytes/LICENSE.txt
Sudoku Solver in 140bytes
View LICENSE.txt
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri -
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
You can’t perform that action at this time.