Skip to content

Instantly share code, notes, and snippets.

View musaid's full-sized avatar
🏠
Working from home

musaid musaid

🏠
Working from home
View GitHub Profile
@musaid
musaid / HandlerLoader.php
Created October 2, 2012 11:05
Handler Loader Class
<?php
/**
* class to load the handlers as callbacks for the given events/tags
* @author musaid <musaid@alliedmaldives.net>
* @version v0.1
*
* usage:
* $handle = new HandlerLoader();
* var_dump($handle->getHandlers('/var/www/crawler/folder/'));
@musaid
musaid / hl_sample.php
Created October 4, 2012 06:07
Handler Loader Class Sample file
<?php
/**
* @name MyClass
* @tags handler, denormalizer,
* some
* @param some-param
* @return return-param
*/
@musaid
musaid / touched.php
Created October 13, 2012 10:06
recording the jobs touched and the number of tries
<?php
$touched = array(
'pidone' => array('ref' => 'somerefno', 'tries' => 1, 'timestamp' => 1350111444),
'pidtwo' => array('ref' => 'anotherrefno', 'tries' => 2, 'timestamp' => 1350111527)
);
$pid = 'pidtwo';
$ref = 'refthree';
@musaid
musaid / jobs_retried.php
Created October 13, 2012 10:42
implemented job retry function
<?php
// register Pheanstalk class loader
require_once('pheanstalk/pheanstalk_init.php');
$pheanstalk = new Pheanstalk('localhost');
$pheanstalk
->watch('touched')
->ignore('default');
$touched = array();
@musaid
musaid / handler_sample_output.txt
Created October 16, 2012 09:47
Handler Loader Class Sample output
SAMPLE OUTPUT
WITHOUT TAGS
array
'Allied\Fun' =>
array
0 => string '$anonymous' (length=10)
'Allied\Some\Event' =>
array
@musaid
musaid / AlliedPDF.php
Created December 2, 2012 03:45
Allied PDF Printing
<?php
/**
* Allied PDF - A Class to print the policy documents as PDF files from the relevant data
*
* @usage Please refer to the associated documentation and/or the inline documentation
* @author musaid <musaid@live.com>
* @version v0.1
*/
// path to the fpdf library
@musaid
musaid / fizzbuzz.c
Created December 19, 2012 23:30
FizzBuzz using the languages i know :)
#include <stdio.h>
int main()
{
int i;
for (i=1; i<101; i++)
((i%5==0 && i%3==0) ? printf("FizzBuzz\n") : ((i%5==0) ? printf("Buzz\n") : ((i%3==0) ? printf("Fizz\n") : printf("%d\n", i))));
return 0;
}
@musaid
musaid / kinky.zsh-theme
Last active December 10, 2015 01:28
Kinky ZSH theme for personal use :)
# ZSH Theme by musaid (musaid@live.com) [http://github.com/musaid]
# FOR PERSONAL USE ONLY
ZSH_THEME_GIT_PROMPT_PREFIX="❴ git:"
ZSH_THEME_GIT_PROMPT_SUFFIX="❵%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}✘ "
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}✔ "
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}✚ "
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%}✹ "
@musaid
musaid / .vimrc
Last active December 10, 2015 01:28
VIM config file. personal use only
" Musaid's standard settings for VIM
" Author: musaid (musaid@live.com) [http://github.com/musaid]
" Version: 1.0
" Smart tabbing / autoindenting
set undolevels=200
set nocompatible
set autoindent
set smarttab
@musaid
musaid / array_are_similar.php
Created December 24, 2012 11:17
A simple function to check if arrays are similar.
/**
* Determine if two associative arrays are similar
*
* Both arrays must have the same indexes with identical values
* without respect to key ordering
*
* @param array $a
* @param array $b
* @return bool
*/