Skip to content

Instantly share code, notes, and snippets.

View biplobice's full-sized avatar
🖥️
while (success!==true) { keepMovingForward(); }

Md Biplob Hossain biplobice

🖥️
while (success!==true) { keepMovingForward(); }
View GitHub Profile
@ryansechrest
ryansechrest / php-style-guide.md
Last active March 20, 2025 17:04
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@asugai
asugai / Install composer on Amazon AMI running on EC2
Last active May 14, 2024 15:14
Install composer on Amazon AMI running on EC2
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install
@irazasyed
irazasyed / bash_profile.md
Last active March 29, 2025 19:27
Terminal: Mac OS X Terminal Aliases & How-To - .bash_profile / .profile

Mac OS X Terminal Aliases & How-To

Collection of some of my fav terminal aliases that I use often & collected from the web. This file will be updated with more aliases as I find more. Feel free to comment and share your fav aliases you use :)

Follow these simple steps to add them to your shell env.

  1. Within the Terminal, run: vim ~/.bash_profile
  2. Type i and then paste the following at the top of the file:
@irazasyed
irazasyed / headers.php
Last active October 13, 2021 16:51
PHP HTTP Headers (Examples)
<?php
# Source: http://www.jonasjohn.de/snippets/php/headers.htm
// Use this header instruction to fix 404 headers
// produced by url rewriting...
header('HTTP/1.1 200 OK');
// Page was not found:
header('HTTP/1.1 404 Not Found');
@stefanschmidt
stefanschmidt / uninstall-parallels7-ml.sh
Last active July 13, 2020 05:45
Completely Uninstall Parallels Desktop 7 on OS X 10.8 (Mountain Lion)
# Unload all Parallels kernel extensions
for kext in $(kextstat | grep parallels | awk '{print $6}'); do kextunload -v 1 -b $kext; done
# Delete all Parallels kernel extensions
rm -v /System/Library/Extensions/prl*
# Delete all other Parallels files
rm -vr \
/Applications/Parallels\ Desktop.app \
/Library/Parallels/Parallels\ Service.app \
@tawfekov
tawfekov / generator.php
Last active October 4, 2024 11:37
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@gibbs
gibbs / currency_symbols.php
Last active August 31, 2024 03:16
An array of currency symbols as HTML entities
<?php
$currency_symbols = array(
'AED' => '&#1583;.&#1573;', // ?
'AFN' => '&#65;&#102;',
'ALL' => '&#76;&#101;&#107;',
'AMD' => '',
'ANG' => '&#402;',
'AOA' => '&#75;&#122;', // ?
'ARS' => '&#36;',
'AUD' => '&#36;',
@plasticbrain
plasticbrain / gist:3863749
Created October 10, 2012 07:34
PHP: (REGEX/preg_match) check for http(s)://
//--------------------------------------------------------------------------
// See if a url contains http:// or https://
//--------------------------------------------------------------------------
if( !preg_match('/http(s?)\:\/\//i', $url) ) {
// URL does NOT contain http:// or https://
}
@cam-gists
cam-gists / memoryuse.php
Created July 28, 2012 07:00
PHP: Memory Usage Class
<?php
/**
* MEMORY USAGE CLASS
* @REF: http://www.if-not-true-then-false.com/2011/php-memory-usage-information-class/
*/
class MemoryUsageInformation {
private $real_usage;
private $statistics = array();
// Memory Usage Information constructor
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>