Do You Have (Or Have You Seen) Twitches in Programming ?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by Robin »

Nsmurf wrote:I'd say the worst habit of mine is not indenting. When I start coding, I just want to get something up and running, so I don't think about indenting, then it ends up as a habit, and I'm to lazy to go back and fix to :(
You know, there are editors that automatically do the indenting for you. I'm so used to that by now that when such a program is not available, it actually hurts to write code. :P
Help us help you: attach a .love.
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by qaisjp »

Robin wrote:
Nsmurf wrote:I'd say the worst habit of mine is not indenting. When I start coding, I just want to get something up and running, so I don't think about indenting, then it ends up as a habit, and I'm to lazy to go back and fix to :(
You know, there are editors that automatically do the indenting for you. I'm so used to that by now that when such a program is not available, it actually hurts to write code. :P
yeah, notepad++ is ace :D
typing the " " (space 4x) is a real pain in the arse when you cant press TAB.
Lua is not an acronym.
jonyzz
Prole
Posts: 48
Joined: Sun Sep 02, 2012 9:35 pm

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by jonyzz »

kikito wrote:My favorite one is "yoda conditions", i.e. typing this:

Code: Select all

if 5 == count then
instead of this:

Code: Select all

if count == 5 then
That reminds me the way how Java programmers usually compare strings:

Code: Select all

if ("stringValue".equals(stringVariable)) ...
When I've first seen this I was wondering why don't they simply write:

Code: Select all

if (stringVariable.equals("stringValue")) ...
The reason is quite simple. In case the stringVariable is null, the first condition evaluates to false, but evaluation of the second one causes NullPointerException.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by Robin »

qaisjp wrote:yeah, notepad++ is ace :D
typing the " " (space 4x) is a real pain in the arse when you cant press TAB.
That's very basic. What I meant more was you type function foo(a, b)<ENTER> and the editor puts a tab on the new line. Same thing, you write end and the editor moves that line one tab to the left.

You can write a while program, never once press tab or shift-tab and still have a completely indented source file.
Help us help you: attach a .love.
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by qaisjp »

Robin wrote:
qaisjp wrote:yeah, notepad++ is ace :D
typing the " " (space 4x) is a real pain in the arse when you cant press TAB.
That's very basic. What I meant more was you type function foo(a, b)<ENTER> and the editor puts a tab on the new line. Same thing, you write end and the editor moves that line one tab to the left.

You can write a while program, never once press tab or shift-tab and still have a completely indented source file.
Oh that, yeah that too (SCITE does that i think) - anyway I don't like automatic indentation*2 now because i am so used to np++)
Lua is not an acronym.
User avatar
tv_user
Citizen
Posts: 57
Joined: Sun Aug 12, 2012 4:39 pm
Location: Portugal

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by tv_user »

Yeah, I miss the times I programmed c++ using an IDE that you do that kind of stuff and much more...actually, I think debugging is the feature I miss the most. Nowadays its just me, textwrangler (great free program btw) and LOVE.
I don't suppose any of you have a Lua IDE hidden somewhere in your old disks, do you? :nyu:
Did my comment help/offended you? Use the Karma button!!
LÖVEing each day...
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by qaisjp »

tv_user wrote:Yeah, I miss the times I programmed c++ using an IDE that you do that kind of stuff and much more...actually, I think debugging is the feature I miss the most. Nowadays its just me, textwrangler (great free program btw) and LOVE.
I don't suppose any of you have a Lua IDE hidden somewhere in your old disks, do you? :nyu:
TextWrangler IS great, I use it whenever I am not using Windows.
Lua IDE's are virtually useless unless you have a framework specific idea, Lua ide's can probably only provide better support for native Lua libraries and some syntax.
Lua is not an acronym.
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by Inny »

Okay, I haven't had much time to think about this, but I think this is the minimum "gimme" that you'd have to take to obfuscate code:

Code: Select all

_={__="char",___=_G}
Why? Because from there we can build arbitrary strings and execute arbitrary code.

Code: Select all

_._=_.__[_.__] -- String.char function via the string metatable
_["!"]=(#"##")^(#"####")*(#"#######") -- 112, or lowercase p
_["@"]=_._(_["!"]+(#"####")).._._(_["!"]+(#"#########")).._._(_["!"]).._._(_["!"]-(#"###########")) -- "type"
_["$"]=_._(_["!"]-(#"####")).._._(_["!"]-(#"#")).._._(_["!"]-(#"##")^(#"####")+(#"#")).._._(_["!"]-(#"############")) -- "load"
_["*"]=_.___[_["$"].._.___[_["@"]]("")] -- loadstring function
Once you're at loadstring, you can basically do anything you want.

I couldn't figure out how to get to "char" from just symbols and _G.

Edit: fixed a typo
Last edited by Inny on Tue Sep 25, 2012 10:22 pm, edited 1 time in total.
User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by Xgoff »

Inny wrote:Okay, I haven't had much time to think about this, but I think this is the minimum "gimme" that you'd have to take to obfuscate code:

Code: Select all

_={__"char",___=_G}
Why? Because from there we can build arbitrary strings and execute arbitrary code.

Code: Select all

_._=_.__[_.__] -- String.char function via the string metatable
_["!"]=(#"##")^(#"####")*(#"#######") -- 112, or lowercase p
_["@"]=_._(_["!"]+(#"####")).._._(_["!"]+(#"#########")).._._(_["!"]).._._(_["!"]-(#"###########")) -- "type"
_["$"]=_._(_["!"]-(#"####")).._._(_["!"]-(#"#")).._._(_["!"]-(#"##")^(#"####")+(#"#")).._._(_["!"]-(#"############")) -- "load"
_["*"]=_.___[_["$"].._.___[_["@"]]("")] -- loadstring function
Once you're at loadstring, you can basically do anything you want.

I couldn't figure out how to get to "char" from just symbols and _G.
have fun debugging
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: Do You Have (Or Have You Seen) Twitches in Programming ?

Post by qaisjp »

Xgoff wrote:have fun debugging
lol, i don't even understand that code...
Lua is not an acronym.
Post Reply

Who is online

Users browsing this forum: darkfrei and 3 guests