When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:
main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)
The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?
The key here is that objects usually have a predefined set of keys, whereas arrays don't:
| # php -v | |
| PHP 5.3.6 (cli) (built: Mar 17 2011 20:58:15) | |
| Copyright (c) 1997-2011 The PHP Group | |
| Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies | |
| # echo '<?php $s = array(); for($x=0;$x<1000;$x++){ $s[] = array("name"=>"Adam","age"=>35); }; echo memory_get_peak_usage(); ' | php | |
| 655040 | |
| # echo '<?php $s = array(); for($x=0;$x<1000;$x++){ $o = new ArrayObject; $o->name = "Adam"; $o->age = 35; $s[] = $o;} echo memory_get_peak_usage(); ' | php | |
| 887984 | 
| <?php | |
| if(!isset($argv[1])){ | |
| echo "Usage: ".$argv[0]." (number of iterations)\n"; | |
| exit(1); | |
| } | |
| /** | |
| * Arrays to check | |
| */ | |
| $tests = array( | 
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" | |
| neturl "net/url" | |
| "time" | |
| ) | 
| package main | |
| import ( | |
| "encoding/json" | |
| "testing" | |
| ) | |
| type foo struct { | |
| ID string `json:"_id"` | |
| Index int `json:"index"` | 
| Per https://code.google.com/p/v8/codesearch#v8/trunk/src/runtime.cc | |
| %CreateSymbol | |
| %CreatePrivateSymbol | |
| %CreateGlobalPrivateSymbol | |
| %NewSymbolWrapper | |
| %SymbolDescription | |
| %SymbolRegistry | |
| %SymbolIsPrivate | 
| import { delay } from 'ts-timeframe'; | |
| import { OperationRegistry } from 'reliable-caching'; | |
| const operationRegistry = new OperationRegistry('costlyFunction'); | |
| async function simulatedCall(a: number, b: number) { | |
| // these 3 lines represent our call | |
| await delay(200); | |
| console.log(`calculated ${a} * ${b}`); | |
| return a * b; | 
Object Calisthenics outlines 9 basic rules to apply when performing the exercise:
| /* | |
| * curry(fn: Function) => Function | |
| * Simple implementation of currying a function | |
| * Drawbacks: | |
| * - Cannot be reused as stored args is mutable | |
| * - Cannot use placeholders | |
| * - Will not check argument overflow | |
| */ | |
| function curry(fn) { | |
| var arity = fn.length; // check the arity of the given function |