Basically:
[code]if (statement)
{
/**
* multiline comment
*/
// single line comment
// this looks fine at times
var a;
// sometimes i'm incredibly annoyed at seeing the one above and i have an extra line after the comment
var a;
// i absolutely hate finding out about invisible whitespace, like:
if (statement)
{
// hi
}
// sometimes i'm fine with writing function names that way
function_name(test, test, test);
// i'm beginning to shift towards javascript's style, but it looks out of place in php D:
functionName(test, test, test);
}[/code]
If in JavaScript I'm wrapping something in little significance:
[code]function($) {
// must be empty lines surrounding the code
// no tabbing for root level code
}(jQuery);[/code]
When writing functions in JavaScript objects, I cannot stand having the { on a separate line, and there must be a space between the statement brackets and the {
[code]{
varone: 'hi',
vartwo: function() {
// hi
}
}[/code]
[editline]10:39PM[/editline]
In jQuery:
[code]var a = $("#selector"); // selectors must be enclosed with "
var b = $('<div></div>').appendTo("#selector"); // html must be enclosed with '
[/code]
[QUOTE=r0b0tsquid;20587945]I NEED to have spaces next to all of my operators, except for concatenator and exponent.
Like this:
[code]
a = b + c
-- but
a = b^c
-- and
a = b..c
[/code]I don't know why.[/QUOTE]
Interesting. What about unary operators? I think they look weird with a space.
Then I have no space on the associative side, but a space on the other. Like this:
[code]num = #table[/code]
Except in the case of "not", where I have a space on each side:
[code]bool = false
if not bool then
--stuff here
end[/code]
That's another of my tics: I always make sure my comments are indented properly, even though they don't actually do anything.
Sorry, you need to Log In to post a reply to this thread.