Skip to content

Instantly share code, notes, and snippets.

@ismaail
ismaail / gist:6193267
Last active June 28, 2023 14:26
File size
<?php
/**
* Convert file size in bytes to nice (human-readable) format.
* This snippet shows you how to convert file size in bytes to nice (human-readable) format in PHP.
* If the size is less than 1 MB, show the size in KB, if it's between 1 MB - 1 GB show it in MB, etc.
*/
function sizeForHuman(int $value, int $decimal = 0): string
{
$units = ['', 'K', 'M', 'B', 'T'];
@ismaail
ismaail / gist:8261354
Created January 4, 2014 22:04
JS self call function
/*jshint strict:true, browser:true, jquery:true, devel:true, curly:true, eqeqeq:true, immed:true, latedef:true, plusplus:true, undef:true, unused:true */
(function(window, document, undefined) {
"use strict";
}(this, this.document));
@ismaail
ismaail / .htaccess
Last active August 29, 2015 14:16
Disable PHP
# Disable php in this folder and subfolders
RemoveHandler .php .phtml .php3
RemoveType .php .phtml .php3
php_flag engine off # Comment this line if PHP 5.5
<Files *>
SetHandler default-handler
</Files>
@ismaail
ismaail / SassMeister-input.scss
Last active August 29, 2015 14:22
Generated by SassMeister.com.
// ----
// libsass (v3.2.4)
// ----
$max: 100;
$step: 10;
@for $i from 0 through ceil($max/$step) {
$value: $i * $step;
.percentage-#{$value} {
[user]
name = Jhone Doe
email = jhone@example.com
[color]
ui = auto
[alias]
logg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
st = status
co = checkout
br = branch
zend_extension=xdebug.so
xdebug.default_enable=1
xdebug.ide_key="phpstorm-xdebug"
xdebug.idekey="phpstorm-xdebug"
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_host=192.168.1.3
xdebug.remote_port=9000
xdebug.remote_connect_back=1
{
"require": {
"phpmd/phpmd": "2.*",
"squizlabs/php_codesniffer": "2.*",
"apigen/apigen": "@stable",
"d11wtq/boris": "@stable"
}
}
.PHONY: up start stop down log artisan migrate scrap phone import composer supervisor-update fix-permissions ide-helper
# Set dir of Makefile to a variable to use later
MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PWD := $(dir $(MAKEPATH))
CONTAINER_FPM := "container_fpm"
CONTAINER_NGINX := "container_nginx"
CONTAINER_SUPERVISOR := "container_supervisor"
up:
@ismaail
ismaail / ModelTest.php
Last active December 21, 2017 05:27
Test Class
<?php
/**
* Class ModelTest
*
* @package AppTest\Model
*
* @codingStandardsIgnoreFile
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
@ismaail
ismaail / select.css
Created April 3, 2018 18:48
Select Input (uniform Browser style)
select.form-control {
padding-right: 20px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gMVEx0lHTdoJgAAAEBJREFUOMtjYBgFyICRHLXomv6TagATmoQ9EZrtCClIgroEG04k1o89WDR3kRqoW5A0byI3Zi4wMDCcG02gNAYA79cSVHAU23YAAAAASUVORK5CYII=') 99% center no-repeat;
}