Skip to content

Instantly share code, notes, and snippets.

View akhedrane's full-sized avatar
🎯
Focusing

Atallah khedrane akhedrane

🎯
Focusing
View GitHub Profile
DROP FUNCTION IF EXISTS levenshtein;
DELIMITER $$
CREATE FUNCTION `levenshtein`( s1 text, s2 text) RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE s1_len, s2_len, i, j, c, c_temp, cost INT;
DECLARE s1_char CHAR;
DECLARE cv0, cv1 text;
SET s1_len = CHAR_LENGTH(s1), s2_len = CHAR_LENGTH(s2), cv1 = 0x00, j = 1, i = 1, c = 0;
IF s1 = s2 THEN
@akhedrane
akhedrane / new_gist_file.js
Last active March 5, 2016 12:43
test gistbox application
function tester(name) {
document.write('hi '+name+' this is just a test from gistbox application');
}
@akhedrane
akhedrane / Convert_FR.sql
Created April 26, 2012 14:29
This MySQL function can convert numbers to french words. usage: SELECT Convert_FR('56.23', 'Dinars','Centimes');
CREATE DEFINER = 'root'@'localhost' FUNCTION `Convert_FR`(chIFfre varchar(20), SM varchar(40),CM varchar(40))
RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
DECLARE ch_int Varchar(20);
DECLARE ch, ch_r Varchar(255);
DECLARE i, fin_I INT;
@akhedrane
akhedrane / JS Util solution using underscore.js
Created January 25, 2012 11:42 — forked from HenrikJoreteg/JS Util solution using underscore.js
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&')
.replace(/>/g,'>')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');