Skip to content

Instantly share code, notes, and snippets.

View junaidpv's full-sized avatar

Junaid P V junaidpv

View GitHub Profile
<?php
/**
* Hooks for Narayam extension
* @file
* @ingroup Extensions
*/
class NarayamHooks {
protected static $disabled = false;
<?php
/**
* NAME
* Narayam
*
* SYNOPSIS
*
* INSTALL
* Put this whole directory under your Mediawiki extensions directory
import codecs
import re
from datetime import datetime
# from http://www.peterbe.com/plog/uniqifiers-benchmark
def f5(seq, idfun=None):
# order preserving
if idfun is None:
def idfun(x): return x
seen = {}
import wikipedia
import codecs
site = wikipedia.getSite('ml','wiktionary')
input_file = codecs.open("title_list.txt", mode="r", encoding='utf-8')
@junaidpv
junaidpv / ext.narayam.js.patch
Created July 17, 2011 01:53
Using .live() method of jQuery.
Index: ext.narayam.core.js
--- ext.narayam.core.js Base (BASE)
+++ ext.narayam.core.js Locally Modified (Based On LOCAL)
@@ -137,6 +137,14 @@
return text;
}
+ function changeVisual( $element ) {
+ if ( enabled ) {
+ $element.addClass( 'narayam-input' );
@junaidpv
junaidpv / ext.narayam.js.patch
Created July 31, 2011 19:30
Example for proper text replacement.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -150,7 +150,54 @@
$element.removeClass( 'narayam-input' );
}
}
+ /**
+ * from: http://stackoverflow.com/questions/3274843/get-caret-position-in-textarea-ie
+ */
+ function offsetToRangeCharacterMove(el, offset) {
@junaidpv
junaidpv / threadpool.py
Created August 7, 2011 14:20
A simple thread pool library for python programs.
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
A simple thread pool.
@author: Junaid P V
@license: GPLv3
"""
@junaidpv
junaidpv / sambandhika.py
Created August 13, 2011 17:22
To get sambandhika form of a malayalam word.
#python3
map_ = (
('്', 'ിന്റെ'),
('ൾ', 'ളുടെ'),
('ൻ', 'ന്റെ'),
('ർ', 'റിന്റെ'),
('ൺ', 'ണിന്റെ'),
('ൽ', 'ലിന്റെ'),
('ം', 'ത്തിന്റെ'),
@junaidpv
junaidpv / ResourceLoader.php
Created August 27, 2011 19:58
Class that helps to load resources with dependencies easily, such as JavaScripts, CSSs
<?php
/**
* @author Junaid P V (http://junaidpv.in)
* @license GPLv3
*/
/**
* Class that helps to load resource easily, such as JavaScripts, CSSs
*
@junaidpv
junaidpv / resouce_loader_usage.php
Created August 27, 2011 20:11
Resouce Loader usage sample.
<?php
// Create object
$resouceLoader = ResourceLoader();
// Somewhere in code
$resourceLoader->add( array (
'jquery' => array(
'styles' => 'css/themename/jquery-ui-1.8.16.custom.css',
'scripts' => array( 'js/jquery-1.4.4.min.js', 'js/jquery-ui-1.8.16.custom.min.js'),
),