Skip to content

Instantly share code, notes, and snippets.

View ArkeologeN's full-sized avatar
💭
what doesn't kill you, makes you smaller :D

Hamzah Waqas ArkeologeN

💭
what doesn't kill you, makes you smaller :D
View GitHub Profile
@ArkeologeN
ArkeologeN / key.txt
Created August 22, 2017 14:22
hamza@macbook.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzxqzCUtauWvQGst68gcBBQnVQe55vjNO+yc7xwkvYbJPJOikvMIhDQJzZb1pt11iOsQWxj/p5wBUzVt6yUjfbycZwHjXWhJU8TAyay4Yvk13x9/r8s5VN6ahmqZUw3FHohpXMMcxb+Fvyzkl3QXxtJxOVb1mlpzA4txrmXlvOBm/oTgq67/fc53290CgoOyzdCVxYRJeOMklDnH6wn6dEdYqH2mQxRL0sw6j0hFFSpTQb9ksCnbnq9SjxDFB9ztH/shYw3ExCLO7c7O3BIJ5XTyEFMTjk9iqqqZa8X71WLDzkeUGmVll23OOXh9BPExAAmxjFd9Yi8rXRnc2un2ff hamza@getcilantro.com
@ArkeologeN
ArkeologeN / custom-error-page
Created April 4, 2017 16:18 — forked from simlegate/custom-error-page
Nginx return custom json
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@ArkeologeN
ArkeologeN / test.js
Created April 15, 2015 17:05
AWS parsing
;(function() {
'use strict';
var http = require('https');
var map = {
"ap-northeast-1": "Tokyo, JP",
"ap-southeast-1": "SG",
"ap-southeast-2": "Sydney, AU",
"eu-central-1": "Frankfurt, DE",
@ArkeologeN
ArkeologeN / sample.c
Last active August 29, 2015 14:03
Uploading File to Witnessio
NSString *urlString = [NSString stringWithFormat:@"http://api.witness.io/1/user/%@/files",idValue];
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:urlString]];
[request addRequestHeader:@"X-WITNESS-TOKEN" value:@"PUT_TOKEN_HERE"];
[request setRequestMethod:@"PUT"];
[request setPostValue:@"My Good file" forKey:@"title"];
[request setPostValue:@"1" forKey:@"format"];
[request setPostValue:@"360" forKey:@"bearing"];
[request setPostValue:@"-90" forKey:@"latitude"];
[request setPostValue:@"90" forKey:@"longitude"];
@ArkeologeN
ArkeologeN / README.md
Created December 27, 2013 01:33 — forked from nikcub/README.md
#-- Boilerplate --
#
# This must be a layer-2 image
# Use the default unless you're customizing layer-2 or below
FROM nodeos/nodeos
# Important to have /root/bin binaries accessible
ENV HOME /root
ENV PATH /root/bin:/usr/bin:/usr/sbin:/bin:/sbin

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: