Skip to content

Instantly share code, notes, and snippets.

View sohelrana820's full-sized avatar
💭
I may be slow to respond.

Sohel Rana sohelrana820

💭
I may be slow to respond.
View GitHub Profile
@sohelrana820
sohelrana820 / minio-commands.md
Last active July 7, 2022 07:02 — forked from a-h-abid/example.lifecycle.json
MinIO MC Commands Quick Sheet

MinIO Commands

## Alias to Minio Server
mc alias set myminio http://localhost:9000 <access-key> <secret-key>

## List Directories (Root Buckets + Directories)
mc ls myminio
mc ls myminio bucket/folder
@sohelrana820
sohelrana820 / fork forced sync
Created July 15, 2018 19:34 — forked from glennblock/fork forced sync
Force your forked repo to be the same as upstream.
git fetch upstream
git reset --hard upstream/master
@sohelrana820
sohelrana820 / app.yaml
Created August 1, 2017 13:35 — forked from darktable/app.yaml
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
@sohelrana820
sohelrana820 / app.yaml
Created August 1, 2017 13:35 — forked from darktable/app.yaml
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
@sohelrana820
sohelrana820 / commands.sh
Created May 12, 2016 20:21
restore Upwork on Ubuntu 14.04
# Problem package: https://launchpad.net/ubuntu/+source/nss
# Repository of package releases: http://security.ubuntu.com/ubuntu/pool/main/n/nss
#
# NOTE: This recipe tested only for ubuntu 14.04 32 bit
# Open ubuntu terminal, copy and paste and run commands below
# Check your ubuntu version
lsb_release -a
# Download old version of nss libraries
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),

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:

<?php
/**
* @Author Shaharia Azam
* @Author URL http://www.shahariaazam.com
*
* @Description this function will make a .zip folder by adding multiple files.
* @link http://php.net/manual/en/book.zip.php
*
* @param array $SourceFiles
* @param string $ZipDestination