Live data from Hacker News

PHP in a Tweet

emanueleminotto.it

11–20 of 58 posts

Re: PHP in a Tweet

#11

I enjoy PHP like I enjoy going home to see my family for the holidays. It's fun for a bit, the nostalgia makes me feel warm and fuzzy, and the familiarity of everything is very comforting. You quickly realize though that the grass really is a lot greener on the other side. You remember why you moved out of your parent's place and went out on your own. It's hilarious looking at how cryptic these one-liners are, partic…

In PHP

   array_sum([1, 2, 3, 4, 5]);

Re: PHP in a Tweet

#12

I enjoy PHP like I enjoy going home to see my family for the holidays. It's fun for a bit, the nostalgia makes me feel warm and fuzzy, and the familiarity of everything is very comforting. You quickly realize though that the grass really is a lot greener on the other side. You remember why you moved out of your parent's place and went out on your own. It's hilarious looking at how cryptic these one-liners are, partic…

you'll love APL:

    x ← 1 2 3 4 5
    +/ x
http://ngn.github.io/apl/web/index.html#code=x%20%u2190%201%...

Re: PHP in a Tweet

#13

I enjoy PHP like I enjoy going home to see my family for the holidays. It's fun for a bit, the nostalgia makes me feel warm and fuzzy, and the familiarity of everything is very comforting. You quickly realize though that the grass really is a lot greener on the other side. You remember why you moved out of your parent's place and went out on your own. It's hilarious looking at how cryptic these one-liners are, partic…

In PHP array_sum([1, 2, 3, 4, 5]);

array_sum_of_1_2_3_4_5();

(Added in PHP 6)

Re: PHP in a Tweet

#14
post #9

At the risk of arousing some people's ire, I really like these tidbits that try to squeeze maximum functionality (albeit a bit dangerous) into a minimum span of characters. It feels a bit like the underhanded C contest in a way since there are so many magnificent ways to self-destruct doing this, but at the same time it's a fun challenge. A while ago, I put together a dirt-simple URL shortener https://twitter.com/eks…

About ID obfuscation: i like to use a small-width block cipher (e.g. 32-bit skipjack). A reversible int->int transform means you don't need an extra DB column, you're never prone to CRC32 collisions, you can still use base36 (why not case-sensitive base62?) for URLs, and with an application secret key there's no chance of reversal.

Well, maybe someone could aim to get many sequential keys and then reverse-engineer the state of the cipher, but that's also possible with your method.

Re: PHP in a Tweet

#16
post #9

At the risk of arousing some people's ire, I really like these tidbits that try to squeeze maximum functionality (albeit a bit dangerous) into a minimum span of characters. It feels a bit like the underhanded C contest in a way since there are so many magnificent ways to self-destruct doing this, but at the same time it's a fun challenge. A while ago, I put together a dirt-simple URL shortener https://twitter.com/eks…

You might also like:

http://www.reddit.com/r/tinycode

Re: PHP in a Tweet

#17

I enjoy PHP like I enjoy going home to see my family for the holidays. It's fun for a bit, the nostalgia makes me feel warm and fuzzy, and the familiarity of everything is very comforting. You quickly realize though that the grass really is a lot greener on the other side. You remember why you moved out of your parent's place and went out on your own. It's hilarious looking at how cryptic these one-liners are, partic…

In PHP array_sum([1, 2, 3, 4, 5]);

In case this was a serious entry... which I honestly can't tell.

The problem with array_sum is not that it's too long but instead that it's combined two rather specific bits of functionality into a fixed (if common) form, while the Ruby code separates the ideas of "folding" and "addition" allowing for many orthogonal creations.

To pick another favorite, in Haskell you could write

    Foldable.foldl1 (+)
which sums any foldable thing—anything which has elements which can be combined together one-by-one. So it'll apply to Trees or Sets or Dictionaries (well, Maps) just as easily while also allowing things like (+) to be replaced by other binary operators.

Re: PHP in a Tweet

#18
post #16
post #9

At the risk of arousing some people's ire, I really like these tidbits that try to squeeze maximum functionality (albeit a bit dangerous) into a minimum span of characters. It feels a bit like the underhanded C contest in a way since there are so many magnificent ways to self-destruct doing this, but at the same time it's a fun challenge. A while ago, I put together a dirt-simple URL shortener https://twitter.com/eks…

You might also like: http://www.reddit.com/r/tinycode

Wow! I do also like that. I like that very much! Thank you for pointing me to that.

Re: PHP in a Tweet

#19

I enjoy PHP like I enjoy going home to see my family for the holidays. It's fun for a bit, the nostalgia makes me feel warm and fuzzy, and the familiarity of everything is very comforting. You quickly realize though that the grass really is a lot greener on the other side. You remember why you moved out of your parent's place and went out on your own. It's hilarious looking at how cryptic these one-liners are, partic…

In PHP array_sum([1, 2, 3, 4, 5]);

    irb(main):001:0> x = [1,2,3,4,5]
    => [1, 2, 3, 4, 5]
    irb(main):002:0> x.inject &:*
    => 120

Re: PHP in a Tweet

#20

people have been creating 140 character music pieces in the supercollider music language for a while. its very tricky to make something that lasts and evolves and has structure and keeps your interest. here are some great ones: http://fredrikolofsson.com/f0blog/?q=node/478 play{a=SinOscFB;sum({|i|a.ar(a.ar(a.ar(a.ar(i+1,1/9,999),1/9,a.ar(1/9,1,1/9)),a.ar(0.1,3),i+2 999),a.ar(1/9,1/9),1/9)}!9)!2}//#SuperCollider r{loo…

this one is amazing: play{a=LFPulse;b=(1..4);Mix(a.ar(a.ar(a.ar(a.ar(b/32)+1/8)+1 b)+(Mix(a.ar(b/64))+a.ar(4/b) (a.ar(a.ar(b/8)) 2+b)) 100))/8!2}//#SuperCollider audio: http://fredrikolofsson.com/f0blog/files/audio/tweet0020.mp3 "this tweet is also totally deterministic and without any randomness. here a lot of nested square wave oscillators creates the complexity. basically there are 4 channels/voices mixed down to…

Reminds me of those:

http://www.youtube.com/watch?v=GtQdIYUtAHg

http://www.youtube.com/watch?v=qlrs2Vorw2Y

http://www.youtube.com/watch?v=tCRPUv8V22o

:)

Post reply on HN