Skip to content

Instantly share code, notes, and snippets.

Hamzah Waqas ArkeologeN

View GitHub Profile
@ArkeologeN
ArkeologeN / key.txt
Created Aug 22, 2017
hamza@macbook.
View key.txt
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzxqzCUtauWvQGst68gcBBQnVQe55vjNO+yc7xwkvYbJPJOikvMIhDQJzZb1pt11iOsQWxj/p5wBUzVt6yUjfbycZwHjXWhJU8TAyay4Yvk13x9/r8s5VN6ahmqZUw3FHohpXMMcxb+Fvyzkl3QXxtJxOVb1mlpzA4txrmXlvOBm/oTgq67/fc53290CgoOyzdCVxYRJeOMklDnH6wn6dEdYqH2mQxRL0sw6j0hFFSpTQb9ksCnbnq9SjxDFB9ztH/shYw3ExCLO7c7O3BIJ5XTyEFMTjk9iqqqZa8X71WLDzkeUGmVll23OOXh9BPExAAmxjFd9Yi8rXRnc2un2ff hamza@getcilantro.com
@ArkeologeN
ArkeologeN / custom-error-page
Created Apr 4, 2017 — forked from simlegate/custom-error-page
Nginx return custom json
View custom-error-page
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 {
View test.js
;(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 Aug 29, 2015
Uploading File to Witnessio
View sample.c
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"];
View README.md
View Dockerfile
#-- 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
View objects_arrays.md

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:

You can’t perform that action at this time.