Skip to content

Instantly share code, notes, and snippets.

View matthewtrask's full-sized avatar
🏠
Working from home

Matt Trask matthewtrask

🏠
Working from home
View GitHub Profile
@vineus
vineus / mylist.md
Last active March 9, 2024 22:12
Software engineering links
@mrkrstphr
mrkrstphr / README.md
Last active February 5, 2019 13:17
Deploying Sculpin Sites to GitHub Pages

Deploying Sculpin Sites to GitHub Pages

I wanted to be able to use Sculpin to generate GitHub pages. Here's what I did...

  1. Created a super awesome Sculpin site from the Sculpin Blog Skeleton

  2. Make sure everything is under version control in my master branch (except things that shouldn't be. see the .gitignore)

  3. Updated publish.sh:

#!/bin/bash

@geksilla
geksilla / bootsrap_class_list
Last active April 29, 2023 03:59
Bootstrap css class list
.navbar
.caret
.label
.table
.img-responsive
.img-rounded
.img-thumbnail
.img-circle
.sr-only
.lead
@nikic
nikic / objects_arrays.md
Last active April 12, 2024 17:05
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

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: