Takes a grid and returns an optimal set of rectangles that fills that grid
For example, the following grid:
[[1,1,0,1,1],
[1,1,1,1,1],
[0,1,1,1,0]]
if foo | |
if bar | |
something | |
else | |
something_else | |
else | |
baz |
BITS 16 | |
before_big_bang: | |
cli | |
mov ax, 0x07C0 | |
mov ds, ax | |
mov es, ax |
# assume the following directory structure where contents of doc/ | |
# and source/ are already checked into repo., with the exception | |
# of the _build directory (i,e. you can check in _themes or _sources | |
# or whatever else). | |
# | |
# proj/ | |
# source/ | |
# doc/ | |
# remove doc/_build/html if present |
Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.
This document is mainly targeted toward iOS development, but definitely applies to Mac as well.
NSString *foo = @"bar";
#import <Foundation/Foundation.h> | |
// NSApplication has this weird habit of trying very hard to load a nib at | |
// launch. If there are none in the app bundle, it'll wander off into the | |
// frameworks until it finds one, then try to use it. | |
// | |
// You know this is what's happening if you get four log messages at launch | |
// saying "Could not connect the action buttonPressed: to target of class | |
// NSApplication". You've deleted MainMenu.nib and removed the "Main nib file |
#!/usr/bin/env php | |
<?php | |
$app = function($request) { | |
$body = <<<EOS | |
<!DOCTYPE html> | |
<html> | |
<meta charset=utf-8> | |
<title>Hello World!</title> |
<?php | |
// secure hashing of passwords using bcrypt, needs PHP 5.3+ | |
// see http://codahale.com/how-to-safely-store-a-password/ | |
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt | |
$salt = substr(strtr(base64_encode(openssl_random_pseudo_bytes(22)), '+', '.'), 0, 22); | |
// 2y is the bcrypt algorithm selector, see http://php.net/crypt | |
// 12 is the workload factor (around 300ms on my Core i7 machine), see http://php.net/crypt |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Detect Full-Screen</title> | |
<style> | |
* { | |
font-family: sans-serif; | |
line-height: 1.5; |
#!/bin/sh | |
exec scala "$0" "$@" | |
!# | |
/* | |
Subset of our Simple Java AST | |
*/ | |
sealed abstract class SJStatement | |
case class SJAssert (assertion : SJExpression) extends SJStatement |