Skip to content

Instantly share code, notes, and snippets.

View fahdi's full-sized avatar

Fahad Murtaza fahdi

View GitHub Profile
@fahdi
fahdi / index.php
Created January 6, 2015 13:17
Error reporting: Optionally, when using Apache, you can use the APPLICATION_ENV setting in your VirtualHost to let PHP output all its errors to the browser. This can be useful during the development of your application. Edit index.php from the zf2-tutorial/public/ directory and change it to the following:
<?php
/**
* Display all errors when APPLICATION_ENV is development.
*/
if ($_SERVER['APPLICATION_ENV'] == 'development') { error_reporting(E_ALL); ini_set("display_errors", 1);
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
@fahdi
fahdi / custom_posts_in_custom_page_template.php
Created February 1, 2015 19:58
Wordpress Custom Post types Paging in Custom Page templates
<?php
/*
*Template Name: Specials and Events
*/
get_header();
?>
<div class="blog-list">
<div class="container">
<div class="row">
<div class="col-md-9">
<?php
add_action('nav_menu_css_class', 'add_current_nav_class', 10, 2 );
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Getting the post type of the current post
@fahdi
fahdi / table.cpp
Created February 18, 2015 08:53
Table Printing
#include<iostream>
using namespace std;
int main(void)
{
cout << "A multiplication table:" << endl
<< " 1\t2\t3\t4\t5\t6\t7\t8\t9" << endl
<< "" << endl;
for(int c = 1; c < 10; c++)
{
@fahdi
fahdi / xml-feed-datatable.js
Last active August 29, 2015 14:17
XML feeds datatable
// XML feeds table
if($('#feed-list-table').length) {
var pfDataTableDefaults = $.extend({}, pfDataTableDefaults, {
"columns": [
{"data": "id"},
{"data": "broker_name"},
{"data": "last_check"},
{"data": "last_change"},
{"data": "feed_url"},
{"data": "validation"},
@fahdi
fahdi / ten-columns.less
Created March 18, 2015 09:06
Create 10 column layout with bootstrap
/*
* Special grid for ten columns,
* using its own scope
* so it does not interfere with the rest of the code
*
* Just update the path for variables.less and mixons.less files and compile the less file
*/
& {
@import (multiple) "../../vendor/bootstrap/less/variables.less";
@fahdi
fahdi / SassMeister-input.scss
Created April 20, 2015 06:10
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
#dashboard-list, #call-dashboard-list {
th {
padding-left: 15px;
font-size: 110%;
@media (max-width: 767px) {
@fahdi
fahdi / training-0001.php
Created June 3, 2015 13:15
PHP OOP 1 Example
<?php
class SimpleClass
{
// property declaration
public $var = 'a default value';
// method declaration
public function displayVar() {
echo $this->var;
}

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users
@fahdi
fahdi / accented.py
Created October 19, 2015 19:58
Accented Characters
# Reference: http://stackoverflow.com/questions/517923/what-is-the-best-way-to-remove-accents-in-a-python-unicode-string
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
#import csv
import unicodedata