Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View haisum's full-sized avatar

Haisum Mussawir haisum

View GitHub Profile
@haisum
haisum / gist:6751115
Created September 29, 2013 10:02 — forked from djaiss/gist:2938259
<?php
$countries =
array(
"AF" => "Afghanistan",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
#
# Sphinx configuration file sample
#
# Please refer to doc/sphinx.html for details.
#
#############################################################################
## data source definition
#############################################################################

How-To: Install Memcache on CentOS (WHM/cPanel)

Without wasting much time, Let us get started!

Follow these simple instructions:

  • Step 1: Login into your WHM panel and using easyapache enable Memcache

  • Step 2: SSH into your server and fire this command yum install memcached.x86_64 php-pecl-memcache.x86_64

@haisum
haisum / mysqlallparents.sql
Last active August 29, 2015 14:14
Query for getting All parents of a category
SELECT T2.id, T2.title,T2.controller,T2.method,T2.url
FROM (
SELECT
@r AS _id,
(SELECT @r := parent_id FROM menu WHERE id = _id) AS parent_id,
@l := @l + 1 AS lvl
FROM
(SELECT @r := 31, @l := 0) vars,
menu m
WHERE @r <> 0) T1
@haisum
haisum / threads.go
Created January 30, 2015 05:01
Simple Threads/Channels code in golang
package main
import (
"fmt"
"time"
)
func main() {
message := make(chan string, 1)
response := make(chan string, 1)
@haisum
haisum / selenium.php
Last active August 29, 2015 14:14
PHP Unit Selenium driver documentation
<?php
/**
* Implementation of the Selenium RC client/server protocol.
*
* @package PHPUnit_Selenium
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
* @version Release: @package_version@
@haisum
haisum / days_months_years.php
Created March 5, 2015 08:08
Loop through years, months and days in php for dropdown
<?php //All months
for($i=1;$i<=12;$i++) {?>
<option value="<?=$i?>"><?=date("F", strtotime("2001-" . $i . "-25"))?></option>
<?php } ?>
<?php
//past 8 years
for($i=0;$i<8;$i++) {?>
@haisum
haisum / locales.js
Created March 6, 2015 06:53
gnu locales list - Language codes and their Descriptive meaning
var locales = {
af_NA: "Afrikaans (Namibia)",
af_ZA: "Afrikaans (South Africa)",
af: "Afrikaans",
ak_GH: "Akan (Ghana)",
ak: "Akan",
sq_AL: "Albanian (Albania)",
sq: "Albanian",
am_ET: "Amharic (Ethiopia)",
am: "Amharic",
@haisum
haisum / install-varnish.sh
Created March 10, 2015 07:39
Varnish Installation on Cpanel or Whm
#!/bin/bash
# This script installs VARNISH Cache along side Apache on cPanel servers.
#This script installs VARNISH, changes the Apache port to 82, writes
# some config files, starts VARNISH, and terminates.
### Made by Shubham Mathur (itseasy21)
#-Colors :D
RED='\033[01;31m'
@haisum
haisum / sticky.css
Created June 15, 2015 11:20
Sticky footer without fixed position
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 80px;
}