Drupy: Drupal in Python
" Drupy is a Python port of the Drupal content management system, which until now was only available in PHP."
This is a great project, filling a big need. Check it out.
The Drupy Project
Practical Approaches to Software Development.
" Drupy is a Python port of the Drupal content management system, which until now was only available in PHP."
This is a great project, filling a big need. Check it out.
The Drupy Project
Posted by
Brendon
at
1:58 PM
0
comments
Here is an easy way to re-run your last shell command which contained a certain word. Mind you, this command can be dangerous if you search on the wrong word.
Update: As a commentor has pointed out, in Bash, you cn simply use Ctrl-R. Genious!
#
# Run last bash shell command containing a certain word.
#
`grep SOMEWORD ~/.bash_history | tail -n1 -`
Posted by
Brendon
at
3:55 AM
1 comments
Here is a beautiful little module I have created which will automagically validate your forms via AJAX, so you get no page refresh when getting back validation information on a Drupal form.
Drupal AJAX Forms Validation
Posted by
Brendon
at
12:26 AM
0
comments
Here it is:
# Get Non Up-to-Date Files in CVS
# This will not work within a Bash alias without proper escaping
# It would be better to put it in file somewhere within you Bash PATH
cvs -qr status | grep Status: | awk '$4 != "Up-to-date" { print $0 }'
Posted by
Brendon
at
3:24 PM
0
comments
Ugh, once again, there is no solid reference on the web for parsing a URL with JavaScript. How ths is possible, I don't know. When you parse a URL, you want a certain amount of information:
* scheme
* user
* pass
* host
* port
* path
* query
This function provides all of these and could be used for example when dealing with any paths within inline page elements such as:
* <script src='XYZ'>
* <a href='XYZ'>
* <link href='XYZ'>
* <iframe src='XYZ'>
* <img src='XYZ'>
Here is the code. As usual, no comments are included, because good, clean, scalable code should comment itself. If you want to debate me on this, I would be more than happy to:
/**
* Parses a URL
* @author B Crawford (info at aphexcreations dotcom)
* @copyright Copyright 2007 B Crawford
* @license You may distribute this as long as you keep this header intact
* @param str (String)
* @return (Object)
*/
getParams = function(str) {
var parts, tmpOut, out, parser, args, i;
parser =
/^((([a-z]+):\/\/)((.+?)(:(.+?))?@)?(.+?\.[a-z]+)(:(\d+))?)?([^\?]+)?(\?(.+))?/i;
parts = str.match(parser);
out = {};
tmpOut = {
scheme : parts[3],
user : parts[5],
pass : parts[7],
host : parts[8],
port : parts[10],
path : parts[11],
query : parts[13]
};
if(tmpOut.scheme === undefined) {
out.scheme = window.location.protocol.toString().match(/^([a-z]+)/i)[1];
}
else {
out.scheme = tmpOut.scheme;
}
if(tmpOut.user === undefined) {
out.user = false;
}
else {
out.user = tmpOut.user;
}
if(tmpOut.pass === undefined) {
out.pass = false;
}
else {
out.user = tmpOut.pass;
}
if(tmpOut.host === undefined) {
out.host = document.domain ? document.domain : 'localhost';
}
else {
out.host = tmpOut.host;
}
if(tmpOut.port === undefined) {
out.port = window.location.port ? parseInt(window.location.port) : 80;
}
else {
out.port = tmpOut.port;
}
if(tmpOut.path === undefined) {
out.path = window.location.pathname ? window.location.pathname : '';
}
else {
out.path = tmpOut.path;
}
if(tmpOut.query === undefined) {
out.query = window.location.search ? window.location.search : '';
}
else {
out.query = tmpOut.query;
}
out.args = {};
args = out.query.split(/&/g);
for(i = 0; i < args.length; i++) {
arg = args[i].split(/\=/);
if(arg[0] !== '') {
if(arg[1]) {
out.args[arg[0]] = arg[1];
}
else {
out.args[arg[0]] = true;
}
}
}
return out;
}
Posted by
Brendon
at
2:54 AM
0
comments
As a web developer and a web user, I have 5 objectives in mind when it comes to browsers and extensions:
1) I don't want ads, spyware, or any XSS attacks.
2) I want to see a page how a normal user will see the page.
3) I don't want to use the mouse. Keyboards are much more efficient.
4) I want to be able to quickly dissect any element within a page.
5) I need an efficient way to manage bookmarks.
So, with that in mind, these are the extensions that make that possible:
1) AdBlock Plus
Not to be confused with AdBlock (proper). This eliminates ads, and does it better than anything else. period.
2) FireBug
This extension alone offers about 90% of the functionality a web developer will ever need. If you need that other 10%, get the Web Developer Toolbar and the Venkman Javascript Debugger. Word of warning though, Venkman does a few things FireBug doesnt do, BUT it is a huge pain in the ass and it's usually not worth the hassle. Hint: For stack traces, include console.trace() in your code.
3) Tab Mix Plus
The main reason I use this is for SIngle Window mode, which basically eliminates all popups and puts new windows in tabs. Hint: Undo Close Tab feature could save your life.
4) NoMouse
NoMouse is my own custom FireFox extension for complete mouseless browsing. It is much more stable than the others and with way more features.
Here is the link to my NoMouse extension:
NoMouseHit-a-HintBuggy, but still the best keyboard navigation extension for FireFox. This assigns a numeric ID to every clickable element on the page, allowing you full keyboard control over any page. Much easier to use than the FireFox Accessibility Plugin, and not nearly as buggy as FireFox Mouseless Browsing Extension. Hint: install keyconfig to improve the usability of this extension.keyconfigChange keybindings for most FireFox extensions. This is more useful than it sounds.
5) Google Toolbar for Firefox
There is only one reason I use this: Google Bookmarks. This has a nice little button to add a page to your google bookmarks. This can come in handy once you start having over 10k+ bookmarks. Hint: disable all other features.
6) NoScript
This is the 2nd best prevntion against XSS attacks for FireFox. The first is to set permissions.default.image to "3" in about:config, but that will disable any third party images from loading which you may not want. Use the whitelist in NoScript and turn everything else off. Despite what the detractors say, you will probably encounter only 1 out of every 100 sites that absolutely need JavaScript to run (aside form the 20 or so that you will have in your everyday usage).
7) Tamper Data
Somewhat lacking in features, but nevertheless does a good job of allowing you to see HTTP traffic as it gets sent to the server. Please note that this does not show FULL HTTP traffic, but it still gives you a lot of information. If you need to view raw traffic, you may want to consider running WireShark.
8) Web Developer Toolbar
This is slowly becoming less relevant due to the ass-kicking nature of FireBug, but is still very useful for disabling stylesheets, editing css, and other little miscellaneous knick-knacks that you need about once a week. Forecast: Obselete in 12 months.
9) MeasureIt
Performs a simple pixel measurement anywhere within the FireFox window. Very useful.
10) ColorZilla
Gives the color value of any pixel within the FireFox window. You will use this more than you realize.
Posted by
Brendon
at
12:29 AM
2
comments
Now, before I get 3000 emails from people saying, "LoLz, ur such teh ghey! OMG, thats not p@ssing by ref3rence!!!", I want to preface this by saying that it is not possible to actually pass a variable by reference in Javascript, but we certainly can achieve the same functionality.
Here is the code..
function foo(_) {
_.val = "Hello World";
}
foo(_={val:null});
alert( _.val);
function getStatus(_) {
_.statusMsg = "Hello World";
return 1;
}
statusCode = getStatus(_={statusMsg:null});
if( statusCode === 1 ) {
alert(_.statusMsg);
}
Posted by
Brendon
at
6:52 PM
0
comments