Do You Have (Or Have You Seen) Twitches in Programming ?
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Do You Have (Or Have You Seen) Twitches in Programming ?
Exactly. Most of the smaller elements of code style is mere opinion, though that opinion is often dear to us (it is in my case anyway).
- 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 ?
I only care about coding style when it affects readability. Using a Smurf Naming Convention, taking Lua's "no significant white space" to the extreme (in either direction)...
Help us help you: attach a .love.
Re: Do You Have (Or Have You Seen) Twitches in Programming ?
Is there anything actually wrong with the yoda conditions, or is it just unusual and so harder to read?
Re: Do You Have (Or Have You Seen) Twitches in Programming ?
They exist as a defensive measure against C's assignment syntax being a valid conditional statement. For instance, this is a common bug in C:IMP1 wrote:Is there anything actually wrong with the yoda conditions, or is it just unusual and so harder to read?
Code: Select all
if (c = 5) doSomething();
/* Branch is unconditional, as 5 is logically true. C is unintentionally modified. */
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Do You Have (Or Have You Seen) Twitches in Programming ?
That's a total abomination.
Yep, valid Lua code:
And it prints "Hello world!".
Seen on Corsix.
Yep, valid Lua code:
Code: Select all
_={_=_G}for--[[]]__--[[]]in(next),_["_"]do(_)[_]=(__)_[#_[_]],_[_[_]:byte(-#"#"
)+#_[_]-(#{}+#"(#''"*#"*#*#*"*#"_[_[]]")]=_[_],_[_]end(_)[_]=_._[_[#""]]{[_._[_
[#""]]]=_}_[""]=_._[_._[_[#[=[=#=]=]*-((#[=[#[=]#]=]))]](_._[_[-#[[_[-#[#_[_]]]
](_))]_[";"]=_._[_[#"#"+(#")#^")^#"#^"]]_["'"]=[[sub]]_['"']=_[""][_["'"]]_["/"
]=[[/_)=.,[#"('*:^;+]]_["'"]=_[""][_['"'](_[-#[[=[=]=]]],-#",_",-#"..").._["'"]
]_["["]=_['"'](_[-#"#-]_"],#",",#{_}).._['"'](_[-#"-"],#",",#"#").._['"'](_[-(#
"^#^")^#"^#"],#"-",#"(").._['"'](_[#_[-#"#"]*-#"[#"],#_[-#"#"],#_[-#"#"]).._[''
..'"'](_[-#[[=[]=]]],#_["/"]/#_["/"],#"/").._['"'](_[-(#"#)-")^#[[""]]],-#"-,",
-#[=[[]]=])_["]"]=_['"'](_[-#_[-#"-"]],#",",#"#").._[";"](_["["]..[=[('\]=]..(#
'#).'*#',..]]'*#'",#"#",'-#'(').."')")().._['"'](_[-#_[-#"-"]],-#_[-#"-"]-#"-",
-#_[-#"-"])_['_']=_[";"](_["["]..'(_[""].'.._[";"](_["["]..[[('\]]..((#_["/"]+#
"'")*#"#*("*#"..").."')")().._['"'](_[#_[-#"_"]*#"[_"],-#"#-,",-#"(,").._['"'](
_[-#_["/"]],-#",",-#"(")..'(_["/"],...,#"#","")-#"#")')_[";"](_["'"](_["'"]([[]
#/#)[([;#.))."[,[:[:[+)/,#[+#)[:[.)))^)^#/#)[([;#.))."[,[:[:[+)/,#[+#)[:[.)))^]
]],"[^".._["/"].."]",""),"(.)(.)",_[";"]("_['.'],_['#']=...".._["["].."(_['']."
.._["]"].."(_['_'](...)*#_['/']+_['_'](_['#'])))")))(...)_={#{...},#{#{}},#"#"}
Seen on Corsix.
Re: Do You Have (Or Have You Seen) Twitches in Programming ?
[quote="Roland_Yonaba"][/quote]
Oh man, that reminds me of that javascript program that can essentially do anything without using any alphanumeric characters. It boiled down to floating into the window and getting the characters you needed from the names of functions you knew would be there.
I'm guessing this program is doing the same, though to be honest, with the string.char command, and the len operator working on strings, you can get everything you want. The challenge is iterating _G to find print, and finding char in the string table, before you can build the characters you want. Then you can do some bit maths to get the characters you want. For instance:
This is going to bake my noodle this weekend. I'll probably be back here on sunday night with my own version of this.
Oh man, that reminds me of that javascript program that can essentially do anything without using any alphanumeric characters. It boiled down to floating into the window and getting the characters you needed from the names of functions you knew would be there.
I'm guessing this program is doing the same, though to be honest, with the string.char command, and the len operator working on strings, you can get everything you want. The challenge is iterating _G to find print, and finding char in the string table, before you can build the characters you want. Then you can do some bit maths to get the characters you want. For instance:
Code: Select all
A = string.char( (#'##')^(#'######') + (#'#') )
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Do You Have (Or Have You Seen) Twitches in Programming ?
Great, looking forward seeing that. Be sure to dispose a fire-extinguisher near your workplace.Inny wrote:This is going to bake my noodle this weekend. I'll probably be back here on sunday night with my own version of this.
Just in case you'll see smoke coming out your ears.
To keep going, just seen some ASCII arts with Lua. Still on Corsix.
Yep, that's Lua Logo.
The original code on the blog is not valid, though. It errs.
Above is a fixed version, found on Codepad.
Challenge opened, who's going to propose the same for Löve ?
Code: Select all
_={_=_G
}for--[[--]]__
in(next),_["_"]do
(_)[_]=(__)_[#_[_]]
=_[_]_[_]="sub"end(_)
[_]=_[_] [_[_]]_[_._]=#"_._"_[
_[_._]]=_[_](_[_[_._]*_ [_._]],_[_._],_[_._
]).._[_](_[(_[_._]+_[_._]/_[_._ ])*_[_._]],_[_._]/
_[_._]+_[_._]/_[_._],_[_._]).._[_](_[_ [_._]*_[_._]],_
[_._]+_[_._]-_[_._]/_[_._],_[_._]+_[_._]-_[ _._]/_[_._]
).._[_](_[_[_._]*_[_._]],_[_._],_[_._]).._[_](_[ _
[_._]*_[_._]],_[_._]/_[_._]-_[_._] ,_[_._
]/_[_._]-_[_._])_[_[_._]*_[_._]+_ [_._]-
_[_._]/_[_._]]=(_)_[_[_._]*_[_._]+ _[_._
]+_[_._]/_[_._]]=(_)_[#_+_[_._]/_[ _._]]
=_._[_[#_-_[_._]-#_/#_]]_[_[#_]]=_[ #_](_[
_[_._]].."(".._[#_-#_/_[_._]].."('" .._[_[_
._]]..[[("\\'..(...+#_*(_[_._]+_[_._] ))..'")')
)()]])_[_[#_]]=_[_[_._]][_[_[#_]](_[_. _]*_[_._])
.._[_[#_]](#_-_[_._]/_[_._]).._[_[#_]](_ [_._]+_[_._]
+_[_._]/_[_._]).._[_[#_]](_[_._]^_[_._]-_[_ ._])]_[_[_[#_]](
#_)]=#_*#_/_[_._]_[_[_[#_]](#_)]=_[_[_[#_]](#_)]+_[_[_[#_]](#_)]/_[(
_._)]_._[_[ _[#_]](_[_[_[#_]](#_)]+#_-_[_._],_[_[_[#_]](#_)]+#_-
#_/#_,_[_[_[ #_]](#_)]+#_/_[_._],_[_[_[#_]](#_)]+#_-#_/_[_._], _[
_[_[#_]](#_) ]+#_+#_/#_)](_[_[#_+_[_._]-_[_._]]](#_*#_/_[_._]-_[_.
_],_[_[_[#_] ](#_)]+_[_._] /_[_. _],_[ _ [_[#_]](#_)]+#_
/_[_._]+_[_. _],_[_[_[#_]]( #_)]+ #_/ _[_. _]+_[_._],_[_[
_[#_]](#_)] +#_-_[_._]-_[_ ._]/_ [_._ ],#_ +#_+_[_._]-_[
_._]/_[_._] ,#_*(_[_._]+_[ _._]) -_[_. _ ],_[_[_[#_]](
#_)]+#_-_[ _._]-_[_._ ]/_ [_._] ,_[_ [_[ #_]](#_)]+#_
-#_/#_,_[ _[_[#_]]( #_) ]+#_/ _[_ ._]+ _[_._],_[_[
_[#_]]( #_)],# _+#_ +# _ /# _ + #_/#_,_[_
[_[#_ ]](#_) ]+_ [_._ ]-_ [_._]/_[_
._],_[_[_[#_]](#_)]+#_-_[_._]/_[_._],(_[_._])^_[_._]*(_[
_._]+_[_._]/_[_._])+_[_._],_[_[_[#_]](#_)]+_[_._]*_[_
._],#_+#_+#_/#_+#_/#_,#_*#_/_[_._]+_[_[_[#_]](#_)]/
_[_[_[#_]](#_)],_[_[_[#_]](#_)]+#_+_[_[_[#_]](
#_)]/_[_[_[#_]](#_)]+_[_[_[#_]](#_)]/_[_[
_[#_]](#_)],_[_[_[#_]](#_)]-_[_._]))
_._=_[_[_._]][_[_[_[#_]](#_)]
]_[(#_)^#_-(#_)-#_]=
_._
Last edited by Roland_Yonaba on Fri Sep 21, 2012 6:56 pm, edited 1 time in total.
Re: Do You Have (Or Have You Seen) Twitches in Programming ?
BTW " let's talk about Javascript." that remind me a videoInny wrote:Oh man, that reminds me of that javascript program that can essentially do anything without using any alphanumeric characters. It boiled down to floating into the window and getting the characters you needed from the names of functions you knew would be there.Roland_Yonaba wrote:
https://www.destroyallsoftware.com/talks/wat
from an old post with more coding jokes
viewtopic.php?f=3&t=7570&p=47719
Re: Do You Have (Or Have You Seen) Twitches in Programming ?
That lua logo is **AWESOME**
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 If I start with something that's indented though, I'm fine...
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 If I start with something that's indented though, I'm fine...
Re: Do You Have (Or Have You Seen) Twitches in Programming ?
I only do that when writing test code, but I cannot handle too much code like that. I do it plenty times in lua.org/demo.html because i cba to press space 4xNsmurf wrote:That lua logo is **AWESOME**
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 If I start with something that's indented though, I'm fine...
Lua is not an acronym.
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests