Skip to content

Instantly share code, notes, and snippets.

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

Mazhar Ahmed mazhar266

💭
I may be slow to respond.
View GitHub Profile
@mazhar266
mazhar266 / class.php
Created March 20, 2016 06:51
Zend Style Code Documentation
<?php
/**
* Short description for class
*
* Long description for class (if any)...
*
* @category Zend
* @package Zend_Magic
* @subpackage Wand
@mazhar266
mazhar266 / strip.php
Created November 15, 2014 04:40
PHP's handy strip_tags( ) function removes HTML tags that look like <word...>, <word.../>, or </word>. However, it doesn't understand the tags it's removing. So We fixed it.
<?php
/**
* Remove HTML tags, including invisible text such as style and
* script code, and embedded objects. Add line breaks around
* block-level tags to prevent word joining after tag removal.
*/
function strip_html_tags( $text )
{
$text = preg_replace(
@mazhar266
mazhar266 / cal.php
Created October 15, 2014 10:51
Calendar in PHP
<?php
function year2array ($year)
{
$res = $year >= 1970;
if ($res)
{
// this line gets and sets same timezone, don't ask why :)
date_default_timezone_set ( date_default_timezone_get () );
@mazhar266
mazhar266 / tyga.js
Last active August 29, 2015 14:06 — forked from thebyrd/tyga.js
// Make it Nasty
function increment (i) {
i ^= (i & ~-~i) | (~i & -~i)
return i
}
@mazhar266
mazhar266 / merge.js
Last active October 5, 2017 12:08
Merge more than one JSON objects into one object in Node.JS
/**
* @name merge
* @author Mazhar Ahmed
*
* this function will merge more than one json objects into one object
*
* @uses
* var object3 = merge(object1, object2);
*
*/
@mazhar266
mazhar266 / index.html
Last active August 29, 2015 14:04
Responsive fix for Windows Mobile 8 (backward compatible)
<!-- beginning of the document -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- rest of the document -->
@mazhar266
mazhar266 / ellipsis-fallback.js
Last active August 29, 2015 14:04
Limiting text with (...) in CSS
function shorten(text, maxLength) {
var ret = text;
if (ret.length > maxLength) {
ret = ret.substr(0,maxLength-3) + "...";
}
return ret;
}
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);

Step 1

Get a VPS that offers 2 or more IP addresses.

Step 2

From the WHM cPanel, find the menu item Service Configuration, select Apache Configuration and then click on Reserved IPs Editor.

Step 3

HTTP status codes

  • 100 "continue"
  • 101 "switching protocols"
  • 102 "processing"
  • 200 "ok"
  • 201 "created"
  • 202 "accepted"
  • 203 "non-authoritative information"
  • 204 "no content"