Posts

Showing posts with the label runtime

JavaScript For In Madness

Have you never instinctively written a for in loop like the next one, instantly correcting it since you need a variable to perform it? for(var k in {oops:null}){ // cool, got "k" here ... // now how do I get // the bloody "oops" value? } This quick post talks about above nonsense case providing a solution I will explain only if anybody will be interested about it, since (I am quite lazy and tired right now and ...) I think I've been able to solve the trick using almost every JavaScript bad practice :D Runtime Assigned For In Loop (function(self, Function){ // Another (C) WebReflection Silly Idea "use strict"; // Mit Style Weirdness var $o; self.o = function o($){ if(!$) self.o = $o; else { $o = self.o; self.o = Function( "$", "return function o(" + new Array(($.length || 0) + 1).join(",k").slice(1) + "){return $(arguments[0])}" ...

Hunspell for JavaScript ? A quick and dirty one: BJSpell

Image
Somebody asked me to implement a web based spell check without plug-ins or specific browsers requirement (we all know banks security policies, for example, every plug-in could be dangerous but maybe they are still using the most un-secure browser still available these days: Internet Explorer 6 ... ) My answer, straight on: Guys, there is nothing available in pure JavaScript, but I can investigate about it That's it, a couple of searches via Google , and nothing as expected ... but hey, wait a minute: what's about FireFox spell checker plug in and Open Office project? Here we are, Hunspell is the answer! BJSpell Project In a full day of self brain storming, history background cases study, and code, plus debug and tests, I created BJSpell , a basic, fast, cross browser, and runtime implementation capable to underline bad words using a pre compiled Hunspell compatible dictionary (one or more). The reason I avoided the usage of the classic " click here for the spell checke...