chirale

IT and beyond

There’s an event I cannot handle on jQuery: the Firefox autocomplete on textarea. If you have to use the keyup event for a string match on textarea content, you have to exclude autocompletion, that is out of keyup logic. To do this, simply add: $(‘#myelement’).attr(‘autocomplete’, ‘off’); to your jQuery. Autocomplete will be disabled and the …

Continue reading

Here an easy way to search and replace each occurrence a group of characters (in this case underscore and minus) with another (in this case a space) on a specified element (in this case each A), using Jquery javascript library. $(“a”).each(function() { $(this).html($(this).html().replace(/[_-]/g,” “)); }); The first argument passed on replace is a regex, if …

Continue reading

*nix command of the day: diff -Naur old new > new.patch Where “old” and “new” are files or directories to patch. Example (a Drupal patch for IDs duplication): $ patch -p0<fapi-5.x-dupe-id_111719-151.patch patching file includes/form.inc $ Creating patch for Drupal: diff -up original.php new.php > filename.patch another example: diff -up path/to/file/example.module path/to/file/exampleNew.module > mypatchname.patch See also: …

Continue reading