PHP.JS on NodeJS

300 views
Skip to first unread message

Buzzedword

unread,
Aug 2, 2010, 8:15:53 PM8/2/10
to nodejs
Hey guys. I haven't had a chance to play with this, I'm mobile right
now. Anybody hear of a JS library called PHP.JS? Just caught it on
SmashingMag @ http://phpjs.org/

I'm interested as hell, what about you?

Marak Squires

unread,
Aug 2, 2010, 8:17:10 PM8/2/10
to nod...@googlegroups.com
No.


--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.


Buzzedword

unread,
Aug 2, 2010, 8:25:35 PM8/2/10
to nodejs
Just curious, why?

On Aug 2, 8:17 pm, Marak Squires <marak.squi...@gmail.com> wrote:
> No.
>
>
>
> On Mon, Aug 2, 2010 at 8:15 PM, Buzzedword <dgar...@gmail.com> wrote:
> > Hey guys. I haven't had a chance to play with this, I'm mobile right
> > now. Anybody hear of a JS library called PHP.JS? Just caught it on
> > SmashingMag @http://phpjs.org/
>
> > I'm interested as hell, what about you?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nodejs" group.
> > To post to this group, send email to nod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .

Marak Squires

unread,
Aug 2, 2010, 8:35:59 PM8/2/10
to nod...@googlegroups.com
1. php has one of the worst apis ever
2. the majority of these functions already exist in much better libraries like underscore or just straight up native in ecma5

to name a few...

To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.

Timothy Caswell

unread,
Aug 2, 2010, 8:43:35 PM8/2/10
to nod...@googlegroups.com
To be fair, there are some useful chunks of js in there, especially for someone wanting to know how to do something is js that used to work in php.  Though 99% of the function should probably be refactored/renamed/rewritten before using them in a node project.

Buzzedword

unread,
Aug 2, 2010, 8:45:31 PM8/2/10
to nodejs
Oh good god, I didn't see that.

I'm honestly more interested in the project than the usage of it-- Are
developers trying to recreate things like PHP/APACHE with JS/NODE(or
other servers), and would they even bother? I agree dominantly with
your second point.

I don't know, I guess you can say I'm tickled curious about why people
are making libraries like this, you know?

On Aug 2, 8:35 pm, Marak Squires <marak.squi...@gmail.com> wrote:
> 1. php has one of the worst apis ever
> 2. the majority of these functions already exist in much better libraries
> like underscore or just straight up native in ecma5
> 3. things like this :http://phpjs.org/functions/usleep:574
>
> to name a few...
>
>
>
> On Mon, Aug 2, 2010 at 8:25 PM, Buzzedword <dgar...@gmail.com> wrote:
> > Just curious, why?
>
> > On Aug 2, 8:17 pm, Marak Squires <marak.squi...@gmail.com> wrote:
> > > No.
>
> > > On Mon, Aug 2, 2010 at 8:15 PM, Buzzedword <dgar...@gmail.com> wrote:
> > > > Hey guys. I haven't had a chance to play with this, I'm mobile right
> > > > now. Anybody hear of a JS library called PHP.JS? Just caught it on
> > > > SmashingMag @http://phpjs.org/
>
> > > > I'm interested as hell, what about you?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "nodejs" group.
> > > > To post to this group, send email to nod...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > <nodejs%2Bunsu...@googlegroups.com<nodejs%252Bunsubscribe@googlegroups. com>

Marak Squires

unread,
Aug 2, 2010, 8:49:41 PM8/2/10
to nod...@googlegroups.com
There are a COUPLE of useful ones, MAYBE.

The majority is mostly crap. I would only use this a reference if you really need something like http://phpjs.org/functions/levenshtein:463 or http://phpjs.org/functions/metaphone:863, etc

To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.

Sami Samhuri

unread,
Aug 2, 2010, 10:23:28 PM8/2/10
to nodejs
On Aug 2, 5:45 pm, Buzzedword <dgar...@gmail.com> wrote:
>
> I don't know, I guess you can say I'm tickled curious about why people
> are making libraries like this, you know?

PHP.js is the result of PHP devs not wanting to know what they were
doing in the browser. They wanted to use the same function names they
were used to from PHP in the browser as well, and just treat JS like
PHP. What could go wrong? :p

PHP.js dumps a whole whack of PHP-ish functions into the global
namespace, complete with inconsistent naming, and inconsistent
argument ordering. You could clean it up and make it JavaScripty and
nice but as Marak pointed out, you'd find that lots of it is just a
thin layer over existing JS functionality, or is already written clean
and nice in libraries such as underscore.js. There's really no reason
to use it unless you're a PHP dev who is scared of learning anything
new. I don't think that applies to anyone here on this list.

-s

Stephen Belanger

unread,
Aug 2, 2010, 11:44:10 PM8/2/10
to nod...@googlegroups.com
I find the stuff on there is more handy to just pick apart and take the useful stuff. For example, I took part of the htmlentities code from there for a project I'm working on, because I didn't remember exactly what all it replaced and couldn't be bothered to look it up. I was at least good enough not to store it globally though, it's stored in a in called str, where I store all my other string manipulation stuff. I had to fix a bunch of stuff though, because I figured out that, in certain conditions, it would replace replace & with &amp;amp; rather than &amp;...apparently it wasn't programmed too well. >.>

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.

gf3

unread,
Aug 3, 2010, 12:20:40 AM8/3/10
to nodejs
It's a good example of how not to do things in javascript.
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .

Buzzedword

unread,
Aug 3, 2010, 12:50:44 AM8/3/10
to nodejs
Yeah, I definitely only heard of PHP.JS today, and I'm pretty set
against it now after a little bit more digging. Wow. Good looking out.

Peter Hewat

unread,
Aug 3, 2010, 4:43:36 AM8/3/10
to nodejs
+1 ;)

At least this discussion thread made me discover underscore.js which
is interesting indeed :)

kvz

unread,
Aug 3, 2010, 5:27:21 AM8/3/10
to nodejs
Hey Guys,

As the creator of php.js I can probably shed some light on this.

The frontpage of http://phpjs.org does some explaining already. To
summarize:
- We really do encourage people to learn JavaScript (in fact we had to
write a whole bunch of it in order to create php.js : )
- In terms of of highlevel functions JavaScript leaves some things to
be desired like sha1, sprintf, and number_format.

But it's been too much of challenge to stop there.
We figured, instead of us deciding what's made public, let's try to
get at least 2 unit tests from the documentation working, and publish
everything with the occasional warning like: "For study purposes." (as
with mentioned usleep).

To compensate for our huge library with functions ranging from useful
to useless, and that varying from person to person, we let end-users
draw their own line with an online compiler: http://phpjs.org/packages/configure
. "We're all consenting adults here" right? : ) It let's you build
tiny namespaced (yes) packages with just the functions that you need,
and trust. Just take what you need and be on your way. There are
already thousands of different packages out there.

At request by some in the node.js community, we've added CommonJS
support to this compiler http://twitter.com/commonjs/status/12610285557
so that you can export e.g. just the date or cryptographic functions
under a php_js object.

I realize PHP has been getting a lot of heat lately, and we're used to
taking some of that. Especially in JavaScript-land where programmers
often have different server-side backgrounds, it seems like we are
appointed to defend PHP's fame and glory. Well we're not about to.
What I will say is this: it's API is known to get the job done, just
ask millions of developers. And this huge audience is already familiar
with it's quirks. So when they take our stripslashes (like node.js
itself did at one point), we at least bring no new surprises to the
table.

We realize not all functions are perfect yet, and the skill-level of
contributors varies. But chances are, we have a better
http://phpjs.org/functions/strtotime:554 than you could hack up in a
week (although you are an elite programmer). Just because it's being
tested & improved upon by so many people in different environments.
Reporting problems is as easy as making a comment, and 270 different
authors have shared their code, ideas & solutions.
As with any open source project we try to get better & better using
hard labor, unit tests, and encouraging people to contribute better
code.
If you've taken our htmlentities, indeed discovered issues and
improved it with your own fixes, you should really consider
contributing those back.

Best whishes,
Kevin van Zonneveld
http://twitter.com/kvz

On Aug 3, 6:50 am, Buzzedword <dgar...@gmail.com> wrote:

Marak Squires

unread,
Aug 3, 2010, 10:12:23 AM8/3/10
to nod...@googlegroups.com
But chances are, we have a better
http://phpjs.org/functions/strtotime:554 than you could hack up in a
week (although you are an elite programmer). 



Just because it's being
tested & improved upon by so many people in different environments.
Reporting problems is as easy as making a comment, and 270 different
authors have shared their code, ideas & solutions.


270 wrongs don't make a right.


To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.

Elijah Insua

unread,
Aug 3, 2010, 10:25:01 AM8/3/10
to nod...@googlegroups.com
I dunno, if I had to choose between the two I'd probably go with php.js' strtotime as it 1) doesn't modify Date.prototype or Function.prototype. 2) is CommonJS compatible

-- Elijah

Marak Squires

unread,
Aug 3, 2010, 10:26:27 AM8/3/10
to nod...@googlegroups.com
I hate you tmpvar.

Marak Squires

unread,
Aug 3, 2010, 10:27:47 AM8/3/10
to nod...@googlegroups.com
and as a preemptive response to further discussion on this thread. 

Never argue with an idiot, they drag you down to their level and beat you with experience


/out

kvz

unread,
Aug 3, 2010, 11:22:20 AM8/3/10
to nodejs
Hey Marak,

You'd be surprised to find some pretty bright minds among those 270
authors. Including nodejs contributors on this very mailinglist.
Don't be so fast to serve them all off as idiots.

With 443 functions ported, we have a ton of QA & refactoring to do on
a lot of them. But the popular ones have already evolved to a higher
plan.
I'm confident that it's a matter of time and people such as yourself
stopping by, pointing out actual problems & propose fixes to get all
of them up there.

I like to think that open source is about just that

On Aug 3, 4:27 pm, Marak Squires <marak.squi...@gmail.com> wrote:
> and as a preemptive response to further discussion on this thread.
>
> Never argue with an idiot, they drag you down to their level and beat you
> with experience
>
> /out
>
> On Tue, Aug 3, 2010 at 10:26 AM, Marak Squires <marak.squi...@gmail.com>wrote:
>
>
>
> > I hate you tmpvar.
>
> > On Tue, Aug 3, 2010 at 10:25 AM, Elijah Insua <tmp...@gmail.com> wrote:
>
> >> I dunno, if I had to choose between the two I'd probably go with php.js'
> >> strtotime as it 1) doesn't modify Date.prototype or Function.prototype. 2)
> >> is CommonJS compatible
>
> >> -- Elijah
>
> >> On Tue, Aug 3, 2010 at 10:12 AM, Marak Squires <marak.squi...@gmail.com>wrote:
>
> >>> *But chances are, we have a better
> >>> **http://phpjs.org/functions/strtotime:554*<http://phpjs.org/functions/strtotime:554>
> >>> * than you could hack up in a
> >>> week (although you are an elite programmer). *
>
> >>>http://www.datejs.com/
>
> >>> *Just because it's being
> >>> tested & improved upon by so many people in different environments.
> >>> Reporting problems is as easy as making a comment, and 270 different
> >>> authors have shared their code, ideas & solutions.*
>
> >>> 270 wrongs don't make a right.
>
> >>> On Tue, Aug 3, 2010 at 5:27 AM, kvz <vanzonnev...@gmail.com> wrote:
>
> >>>> Hey Guys,
>
> >>>> As the creator of php.js I can probably shed some light on this.
>
> >>>> The frontpage ofhttp://phpjs.orgdoes some explaining already. To
> >>>> summarize:
> >>>> - We really do encourage people to learn JavaScript (in fact we had to
> >>>> write a whole bunch of it in order to create php.js : )
> >>>> - In terms of of highlevel functions JavaScript leaves some things to
> >>>> be desired like sha1, sprintf, and number_format.
>
> >>>> But it's been too much of challenge to stop there.
> >>>> We figured, instead of us deciding what's made public, let's try to
> >>>> get at least 2 unit tests from the documentation working, and publish
> >>>> everything with the occasional warning like: "For study purposes." (as
> >>>> with mentioned usleep).
>
> >>>> To compensate for our huge library with functions ranging from useful
> >>>> to useless, and that varying from person to person, we let end-users
> >>>> draw their own line with an online compiler:
> >>>>http://phpjs.org/packages/configure
> >>>> . "We're all consenting adults here" right? : ) It let's you build
> >>>> tiny namespaced (yes) packages with just the functions that you need,
> >>>> and trust. Just take what you need and be on your way. There are
> >>>> already thousands of different packages out there.
>
> >>>> At request by some in the node.js community, we've added CommonJS
> >>>> support to this compilerhttp://twitter.com/commonjs/status/12610285557
> >>>> so that you can export e.g. just the date or cryptographic functions
> >>>> under a php_js object.
>
> >>>> I realize PHP has been getting a lot of heat lately, and we're used to
> >>>> taking some of that. Especially in JavaScript-land where programmers
> >>>> often have different server-side backgrounds, it seems like we are
> >>>> appointed to defend PHP's fame and glory. Well we're not about to.
> >>>> What I will say is this: it's API is known to get the job done, just
> >>>> ask millions of developers. And this huge audience is already familiar
> >>>> with it's quirks. So when they take our stripslashes (like node.js
> >>>> itself did at one point), we at least bring no new surprises to the
> >>>> table.
>
> >>>> We realize not all functions are perfect yet, and the skill-level of
> >>>> contributors varies. But chances are, we have a better
> >>>>http://phpjs.org/functions/strtotime:554than you could hack up in a
> >>>> <nodejs%2Bunsu...@googlegroups.com<nodejs%252Bunsubscribe@googlegroups. com>

Marak Squires

unread,
Aug 3, 2010, 11:34:27 AM8/3/10
to nod...@googlegroups.com
You've almost motivated me to release http://github.com/marak/javascript-fu out of spite.



To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.

Joe Developer

unread,
Aug 3, 2010, 12:12:37 PM8/3/10
to nod...@googlegroups.com
On Tue, Aug 3, 2010 at 10:34 PM, Marak Squires <marak....@gmail.com> wrote:
You've almost motivated me to release http://github.com/marak/javascript-fu out of spite.


// removes leading and trailing whitespace from string
exports.toTrim = function( str ){
  return str;
};

quite. 

Marak Squires

unread,
Aug 3, 2010, 12:18:40 PM8/3/10
to nod...@googlegroups.com
?

Marak Squires

unread,
Aug 3, 2010, 12:20:05 PM8/3/10
to nod...@googlegroups.com
what part of unreleased did you not grok?

Stephen Belanger

unread,
Aug 3, 2010, 12:26:03 PM8/3/10
to nod...@googlegroups.com
Yeah, I as going to say--look through the rest of it and you see tons of comments about functions being unfinished. Right in that same file a few lines above you see this aswell;

exports.toPercent = function(number){
  // TODO: add more stripping and formatting logic
  return number;
};

Obviously it's not done yet.

Joe Developer

unread,
Aug 3, 2010, 12:38:35 PM8/3/10
to nod...@googlegroups.com
On Tue, Aug 3, 2010 at 11:26 PM, Stephen Belanger <cyruz...@gmail.com> wrote:
Yeah, I as going to say--look through the rest of it and you see tons of comments about functions being unfinished. Right in that same file a few lines above you see this aswell;


exports.toPercent = function(number){
  // TODO: add more stripping and formatting logic
  return number;
};

Obviously it's not done yet.

Nor is php.js :: We are still trying to port and perfect functions. 


On Tue, Aug 3, 2010 at 9:20 AM, Marak Squires <marak....@gmail.com> wrote:
what part of unreleased did you not grok?
On the same basis, what part of:
We are still trying to port and perfect functions. 
did you not get? 

PHP is largely anathema for me, but that is no reason to disparage the project in such a hypocritical and cunty fashion.

At least you now have 1 line that is not ridiculous hyperbole, congratulations.  

Marak Squires

unread,
Aug 3, 2010, 12:51:36 PM8/3/10
to nod...@googlegroups.com
just added?

updated docs, added warning
Marak (author)
July 15, 2010


magic time machine to july 15th time?

Joe Developer

unread,
Aug 3, 2010, 12:55:44 PM8/3/10
to nod...@googlegroups.com
On Tue, Aug 3, 2010 at 11:51 PM, Marak Squires <marak....@gmail.com> wrote:
just added?

updated docs, added warning
Marak (author)
July 15, 2010


magic time machine to july 15th time?
Marak pushed to master at Marak/javascript-fu 27 minutes ago
  •  ef60bf5 
    Merge branch 'master' of github.com:Marak/javascript-fu
  •  b6062ff 
    updated docs, added warning

    You are the man, dawg. 

Marak Squires

unread,
Aug 3, 2010, 1:07:34 PM8/3/10
to nod...@googlegroups.com
uhhh okay? i added that comment last month. you'll have to forgive me for not pushing changes to github on one of the 100 or so projects i'm actively working on (only a fraction of which exist on github). i'm sorry if i deeply offended you by posting a link to a unreleased project which i don't really have any immediate intentions on finishing and which probably has more watchers then your entire github account. i'm glad you are taking the time to scrutinize things which have little or no relevance to really anything going on in here. if i really gave a shit about that library i would have finished it already, i was merely pointing out other initiatives which have a far superior approach then phpjs. to drill into the specific methods of that approach which aren't implemented / might never get implemented, is just retarded. 


speaking of hypnocritial and cunty.

DO NOT USE PHPJS FOR ANY REASON EVER. ITS THE WORST LIBRARY IN EXISTENCE AND ITS DEVELOPERS ARE TROGLODYTES WHO SHOULD BE LOCKED IN A BASEMENT AND FED $ SIGNS UNTIL THEY SEGFAULT AND NEVER RESTART AGAIN.

PHPJS IS FOR PEOPLE WHO ARE TOO SCARED TO USE ANYTHING BUT PHP

PHPJS IS RESPONIBLE FOR OVER 500,000 DEATHS IN THE UNITED STATES EVERY YEAR

PHPJS RAN OVER MY DOG

PHPJS ATE MY BALLS

Sotonin

unread,
Aug 3, 2010, 1:10:04 PM8/3/10
to nod...@googlegroups.com
Why do you even bother? There's no place for retardedness like this in a programming mailinglist. It's very immature and really does anybody care if you hate php?

Marak Squires

unread,
Aug 3, 2010, 1:14:38 PM8/3/10
to nod...@googlegroups.com
on second thought, i encourage everyone to use this library.

at least that way i'll know who to avoid. 

Marco Rogers

unread,
Aug 3, 2010, 1:25:59 PM8/3/10
to nodejs
I love to see people bite at Marak's troll bait.

@kvz, I tend to agree that there is some good code in phpjs but you
have to search for it. I think it does a disservice to those hidden
gems to package it as "php in javascript". You'll find that the
nodejs/commonjs community is populated with people who have
backgrounds in PHP and are actively running away from it. Regardless
of how "true" it is, the PHP language has a reputation for being
inconsistent and encouraging bad code. Lots of people will actively
try to block that from invading nodejs.

My advice would be to start actively cultivating and cherry-picking
the good stuff, packaging them under nice libraries and releasing them
separate from phpjs. Code is like food in that a lot of the initial
interest is bought with the presentation.

:Marco

On Aug 3, 1:10 pm, Sotonin <soto...@gmail.com> wrote:
> Why do you even bother? There's no place for retardedness like this in a
> programming mailinglist. It's very immature and really does anybody care if
> you hate php?
>
> On Tue, Aug 3, 2010 at 12:07 PM, Marak Squires <marak.squi...@gmail.com>wrote:
>
>
>
> > uhhh okay? i added that comment last month. you'll have to forgive me for
> > not pushing changes to github on one of the 100 or so projects i'm actively
> > working on (only a fraction of which exist on github). i'm sorry if i deeply
> > offended you by posting a link to a unreleased project which i don't really
> > have any immediate intentions on finishing and which probably has more
> > watchers then your entire github account. i'm glad you are taking the time
> > to scrutinize things which have little or no relevance to really anything
> > going on in here. if i really gave a shit about that library i would have
> > finished it already, i was merely pointing out other initiatives which have
> > a far superior approach then phpjs. to drill into the specific methods of
> > that approach which aren't implemented / might never get implemented, is
> > just retarded.
>
> > speaking of hypnocritial and cunty.
>
> > DO NOT USE PHPJS FOR ANY REASON EVER. ITS THE WORST LIBRARY
> > IN EXISTENCE AND ITS DEVELOPERS ARE TROGLODYTES WHO SHOULD BE LOCKED IN A
> > BASEMENT AND FED $ SIGNS UNTIL THEY SEGFAULT AND NEVER RESTART AGAIN.
>
> > PHPJS IS FOR PEOPLE WHO ARE TOO SCARED TO USE ANYTHING BUT PHP
>
> > PHPJS IS RESPONIBLE FOR OVER 500,000 DEATHS IN THE UNITED STATES EVERY YEAR
>
> > PHPJS RAN OVER MY DOG
>
> > PHPJS ATE MY BALLS
>
> > On Tue, Aug 3, 2010 at 12:55 PM, Joe Developer <joe.d.develo...@gmail.com>wrote:
>
> >> On Tue, Aug 3, 2010 at 11:51 PM, Marak Squires <marak.squi...@gmail.com>wrote:
>
> >>> just added?
>
> >>> updated docs, added warning
>
> >>>  Marak (author)
> >>>  July 15, 2010
>
> >>>  magic time machine to july 15th time?
>
> >>http://github.com/Marak
> >> Marak pushed to master at Marak/javascript-fu<http://github.com/Marak/javascript-fu/tree/master>
> >>  27 minutes ago
>
> >>    -  ef60bf5<http://github.com/Marak/javascript-fu/commit/ef60bf50973088bd9778474c...>
>
> >>    Merge branch 'master' of github.com:Marak/javascript-fu
>
> >>    -  b6062ff<http://github.com/Marak/javascript-fu/commit/b6062ff9e94ee47e616a0d9d...>
>
> >>    updated docs, added warning
>
> >>    You are the man, dawg.
>
> >> <http://github.com/Marak>
>
> >>> On Tue, Aug 3, 2010 at 12:38 PM, Joe Developer <
> >>> joe.d.develo...@gmail.com> wrote:
>
> >>>> On Tue, Aug 3, 2010 at 11:26 PM, Stephen Belanger <cyruzdr...@gmail.com
> >>>> > wrote:
>
> >>>>> Yeah, I as going to say--look through the rest of it and you see tons
> >>>>> of comments about functions being unfinished. Right in that same file a few
> >>>>> lines above you see this aswell;
>
> >>>>> exports.toPercent = function(number){
>
> >>>>>   // TODO: add more stripping and formatting logic
>
> >>>>>   return number;
>
> >>>>> };
>
> >>>>> Obviously it's not done yet.
>
> >>>> Nor is php.js :: We are still trying to port and perfect functions.
>
> >>>>> On Tue, Aug 3, 2010 at 9:20 AM, Marak Squires <marak.squi...@gmail.com
> >>>>> > wrote:
>
> >>>>>> what part of unreleased did you not grok?
>
> >>>>> On the same basis, what part of:
> >>>> We are still trying to port and perfect functions.
> >>>> did you not get?
>
> >>>> PHP is largely anathema for me, but that is no reason to disparage the
> >>>> project in such a hypocritical and cunty fashion.
>
> >>>> Yes, I see you just added this:
> >>>>http://github.com/Marak/javascript-fu/commit/b6062ff9e94ee47e616a0d9d...
> >>>> At least you now have 1 line that is not ridiculous hyperbole,
> >>>> congratulations.
>
> >>>>>> On Tue, Aug 3, 2010 at 12:18 PM, Marak Squires <
> >>>>>> marak.squi...@gmail.com> wrote:
>
> >>>>>>> ?
>
> >>>>>>> On Tue, Aug 3, 2010 at 12:12 PM, Joe Developer <
> >>>>>>> joe.d.develo...@gmail.com> wrote:
>
> >>>>>>>> *
>
> >>>>>>>> *
>
> >>>>>>>> On Tue, Aug 3, 2010 at 10:34 PM, Marak Squires <
> >>>>>>>> marak.squi...@gmail.com> wrote:
>
> >>>>>>>>> You've almost motivated me to release
> >>>>>>>>>http://github.com/marak/javascript-fuout of spite.
>
> >>>>>>>>>  // removes leading and trailing whitespace from string
>
> >>>>>>>> exports.toTrim = function( str ){
>
> >>>>>>>>   return str;
>
> >>>>>>>> };
>
> >>>>>>>> quite.
>
> >>>>>>>>>> > >>>> The frontpage ofhttp://phpjs.orgdoessome explaining
> ...
>
> read more »

Stephen Belanger

unread,
Aug 3, 2010, 1:29:05 PM8/3/10
to nod...@googlegroups.com
I'm surprised no one has commented on the fact that there has been years of work from nearly 300 developers and it's not "perfected" yet. Not to be a jerk about it, but many parts of phpjs are poorly programmed. Maybe there is some good contributors, but there is also many mediocre ones. Whether that be in their understanding of one language or the other, or their inadequacy focused elsewhere; I do not know. But I DO know that phpjs should not be treated as anything more than a learning tool. If you are serious about programming, you will pick it apart and learn how it works for yourself.

I'm actually kind of surprised that the creator of the phpjs project himself would treat it as a self-contained library.

Arnout Kazemier

unread,
Aug 3, 2010, 1:31:55 PM8/3/10
to nod...@googlegroups.com
There is nothing wrong with using PHPJS with Node. But the biggest downside that you will run in to is that they are not build for node.
They are build for multiple JavaScript engines, so they will include work around for browser that are not needed for Node.
This creates a un-needed overhead, but if you can live with that. Go a head.

What I would say, be inspired by PHPJS but role your own, it will most likely run faster and perform better if you build a dedicated version without workarounds.
For example my soundex function ( http://github.com/3rd-Eden/node-algorithms/blob/master/algorithms.js#L6-29 ) works faster than the PHPjs soundex http://phpjs.org/functions/soundex:520.

But that's just my 2 cent's If you are happy using phpjs on your Node.js go a head. Use it, it will probably run fine. But just keep in mind you are working on a dedicate JavaScript engine, there is no need to for cross engine compliance / patches / hacks / bacon.

> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
>

Arnout Kazemier
in...@3rd-Eden.com

Camilo Aguilar

unread,
Aug 3, 2010, 1:31:27 PM8/3/10
to nod...@googlegroups.com
Marak is the kid of this mailing list, don't pay attention, just ignore him. When He becomes an adult, his comments will be a little more professional. At least I hope that :)

Isaac Schlueter

unread,
Aug 3, 2010, 1:35:55 PM8/3/10
to nod...@googlegroups.com
@kvz: Well said.

@Marak: You're a bastard, Jim.

Personally, I'd never use php.js for anything real. But it's an
interesting project. The collection of functions in php is like this
huge awful disorganized encyclopedia of random crap that you can do in
code. Showing how to do all those things in JS is useful. If you
need to do something, and know the php function for it, then looking
at php.js can be very helpful, and can be a lot faster than designing
the algorithm yourself. Kind of like how, if you need to build a
red-black B-tree, you might check wikipedia first to read up on the
concepts involved. Occasionally it's simple enough to copy paste, and
other times, you might go "GAH! that's terrible!" and rethink your
approach. (As I'd hope someone would do if they thought that they
need usleep in JS.)

I'm not particularly sold on the "it has so much QA" argument, though.
I've heard the same thing said about php itself. QA can't fix a
design that is fundamentally sloppy, and that sloppy design limits the
utility of the QA. Bad things are lying in wait for any user of php,
or php.js. That "shotgun of functions, then fix them" approach, it's
like evolution: you end up with appendixes and wisdom teeth and
platypuses. Code should be intelligently designed.

--i

Isaac Schlueter

unread,
Aug 3, 2010, 1:39:11 PM8/3/10
to nod...@googlegroups.com
Also:

Given several billion years, the evolutionary design process would
probably produce great things. Maybe php version 6E10 will have a
function called mk_smallTalk that can chat about the weather and ask
you how your kids are. But most of us don't have that kind of time.

--i

Marco Rogers

unread,
Aug 3, 2010, 1:56:57 PM8/3/10
to nodejs
M-x doctor

kvz

unread,
Aug 3, 2010, 2:51:51 PM8/3/10
to nodejs
Hey Marak,

Not being a native english speaker I had to double-check on the word
"spite" to find: "A desire to hurt, annoy, or offend someone"

You haven't succeeded. Your lib looks really nice actually, and I hope
you launch it soon.
Should you get stuck on exports.toDate() with that, be sure that you
can always take a quick peek at http://phpjs.org/functions/strtotime:554
One eye closed.. I won't say a thing.

Best whishes,
Kevin van Zonneveld
http://twitter.com/kvz

PS
Looks like while you were copy-pasting, your lib got contaminated with
code by a php.js author. Luckily with Git you can rewrite history so
there's still hope.

On Aug 3, 5:34 pm, Marak Squires <marak.squi...@gmail.com> wrote:
> You've almost motivated me to releasehttp://github.com/marak/javascript-fuoutof spite.
> > > >>>> The frontpage ofhttp://phpjs.orgdoessome explaining already. To
> > > >>>>http://phpjs.org/functions/strtotime:554thanyou could hack up in a
> > > >>>> <nodejs%2Bunsu...@googlegroups.com<nodejs%252Bunsubscribe@googlegroups. com>
> ...
>
> read more »

Marak Squires

unread,
Aug 3, 2010, 3:00:44 PM8/3/10
to nod...@googlegroups.com
+20 points for Kevin keeping a cool demeanor 


To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.

Buzzedword

unread,
Aug 3, 2010, 3:29:57 PM8/3/10
to nodejs
So I'm working on a library called VB.JS...

Just kidding guys! Didn't mean to cause such contention. Apologies
around.

On Aug 3, 3:00 pm, Marak Squires <marak.squi...@gmail.com> wrote:
> +20 points for Kevin keeping a cool demeanor
> *
> *
> *
> *
>
>
>
> On Tue, Aug 3, 2010 at 2:51 PM, kvz <vanzonnev...@gmail.com> wrote:
> > Hey Marak,
>
> > Not being a native english speaker I had to double-check on the word
> > "spite" to find: "A desire to hurt, annoy, or offend someone"
>
> > You haven't succeeded. Your lib looks really nice actually, and I hope
> > you launch it soon.
> > Should you get stuck on exports.toDate() with that, be sure that you
> > can always take a quick peek athttp://phpjs.org/functions/strtotime:554
> > > > > >>>> The frontpage ofhttp://phpjs.orgdoessomeexplaining already. To
> > > > > >>>>http://phpjs.org/functions/strtotime:554thanyoucould hack up in
> ...
>
> read more »

Ryan Gahl

unread,
Aug 3, 2010, 3:32:03 PM8/3/10
to nod...@googlegroups.com

On Tue, Aug 3, 2010 at 2:29 PM, Buzzedword <dga...@gmail.com> wrote:
So I'm working on a library called VB.JS...


And I'm deep into js.js which is the entire ECMA script spec implemented in pure javascript. You can do things like double closures and pollute TWO global namespaces.

Marak Squires

unread,
Aug 3, 2010, 3:34:43 PM8/3/10
to nod...@googlegroups.com
http://en.wikipedia.org/wiki/Narcissus_(JavaScript_engine)

--
You received this message because you are subscribed to the Google Groups "nodejs" group.

Ryan Gahl

unread,
Aug 3, 2010, 3:37:03 PM8/3/10
to nod...@googlegroups.com
Even better, not only will my project be useless, but also redundant! FTW

Who's working on j2ee.js?

Sotonin

unread,
Aug 3, 2010, 3:44:36 PM8/3/10
to nod...@googlegroups.com
QBASIC.JS FTW

Buzzedword

unread,
Aug 3, 2010, 3:44:15 PM8/3/10
to nodejs
http://mxr.mozilla.org/mozilla/source/js/narcissus/js.js

Yeah, my mind exploded a little bit just now.

On Aug 3, 3:34 pm, Marak Squires <marak.squi...@gmail.com> wrote:
> http://en.wikipedia.org/wiki/Narcissus_(JavaScript_engine)
>
>
>
> On Tue, Aug 3, 2010 at 3:32 PM, Ryan Gahl <ryan.g...@gmail.com> wrote:
>
> > On Tue, Aug 3, 2010 at 2:29 PM, Buzzedword <dgar...@gmail.com> wrote:
>
> >> So I'm working on a library called VB.JS...
>
> > And I'm deep into js.js which is the entire ECMA script spec implemented in
> > pure javascript. You can do things like double closures and pollute TWO
> > global namespaces.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nodejs" group.
> > To post to this group, send email to nod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com<nodejs%2Bunsu...@googlegroups.com>
> > .

kvz

unread,
Aug 3, 2010, 4:14:14 PM8/3/10
to nodejs
Marco Rogers: Thanks for your advice. I agree. I was thinking php.js
however could just be this huge resource. Other projects could fork it/
use parts of it, and wrap some of it's functionality up it real tasty.
Maybe Marak could do that : )

Stephen Belanger: Simple. It's a huge amount of work. I'm really happy
to have 2 very bright core members (Brett Zamir, Theriault) at my side
but we're always on the lookout for more help.
btw: We discourage people to use those big packages. They are for
study only.

Arnout Kazmier: That is true. We have CommonJS packaging but we're not
nodejs specific. base64_encode() for instance first checks for a
native implementation before going all raw JavaScript. The aim is that
functions work in IE, Rhino, and other quirky JavaScript platforms as
well so if you need speed, you'd better strip those parts where
applicable. It could still save you the time from starting from
scratch though. And probably 1 or 2 bugs that have been reported by
the community.

Isaac Schlueter: It really does need more QA & refactoring though. We
want to jslint all 433 functions and fix coding style & rookie
mistakes while at it. Anyone know of a good tool to automate the first
2? Anyway, lot of work for someone who's bootstrapping a startup ; )


..don't forget about ruby guys! http://jsclass.jcoglan.com/


Best wishes,
Kevin van Zonneveld
http://twitter.com/kvz


Stephen Belanger

unread,
Aug 3, 2010, 4:42:22 PM8/3/10
to nod...@googlegroups.com
It's a huge amount of work if you are trying to implement the entire language, but I doubt anyone actually has a use for the entire language. Just bits and pieces here and there, in which case; you are better off rolling your own.

I imagine most of us already have plenty of our own accessory libraries that handle that stuff anyway.

Not to discount what you've done, it's a handy learning resource. But I would definitely avoid encouraging copy/paste "knowledge"...there's far too many self-proclaimed "programmers" that really just have a decent knowledge of how to hack together bits of code copied from other people. That's not programming. >.>

To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.

Marco Rogers

unread,
Aug 3, 2010, 5:58:49 PM8/3/10
to nodejs

>
> Not to discount what you've done, it's a handy learning resource. But I
> would definitely avoid encouraging copy/paste "knowledge"...there's far too
> many self-proclaimed "programmers" that really just have a decent knowledge
> of how to hack together bits of code copied from other people. That's not
> programming. >.>
>
>

Sure it is. It's just not very respectable. It's not that different
from gluing together libraries in order to get something done. You
still have to understand what's happening to a certain extent. And if
you don't you'll quickly run into something you can't figure out. You
can't build anything non-trivial by copy-pasting. And if you do, it
probably won't work very well. My point is that copy-pasting is on
one extreme while rolling your own is at the other. Much of the bad
code in php.js is a result of people rolling their own without
thinking very hard about it.

With that being said, I agree with Stephen. It takes lots of
experience to distinguish bad code from not-bad code (notice I didn't
say "good"). And even then it's still somewhat subjective. Right
now, rather than being a good resource for *learning*, php.js is a
good resource for copying code. And much of it shouldn't be copied.
A repackaging and cultivation of the not-bad content would help
address this.

Yes it's a lot of work, but it's also worthwhile. There's a lot of
really good functionality in php. It's just really ugly. Clean it up
and make it manageable and people will use it. I was looking for an
sprintf replacement just the other day.

:Marco

Stephen Belanger

unread,
Aug 3, 2010, 6:23:08 PM8/3/10
to nod...@googlegroups.com
I'm referring mostly to the extreme cases...which sadly, there is quite a few of around here.

The one's that couldn't make a well-formed static html page without Dreamweaver holding their hand.
The one's that use that horrid "rollover" code that Dreamweaver generates to make menu item rollovers.
The one's that still use tables, because they can't understand how CSS works.

Sadly that describes 90% of "web design" companies where I'm from. >.>


--

Marak Squires

unread,
Aug 3, 2010, 12:25:08 PM8/3/10
to nod...@googlegroups.com
why am i still even in this thread?


if you feel like posting random links into my random unreleased / unfinished / unplanned library, at least link to the test suite.

i'd much rather see an initiative like this worked on then some phpjs bullshit.

On Tue, Aug 3, 2010 at 12:20 PM, Marak Squires <marak....@gmail.com> wrote:
what part of unreleased did you not grok?
On Tue, Aug 3, 2010 at 12:18 PM, Marak Squires <marak....@gmail.com> wrote:
?


On Tue, Aug 3, 2010 at 12:12 PM, Joe Developer <joe.d.d...@gmail.com> wrote:
On Tue, Aug 3, 2010 at 10:34 PM, Marak Squires <marak....@gmail.com> wrote:
You've almost motivated me to release http://github.com/marak/javascript-fu out of spite.

// removes leading and trailing whitespace from string
exports.toTrim = function( str ){
  return str;
};

quite. 
 
> >>>> The frontpage ofhttp://phpjs.orgdoes some explaining already. To
> >>>>http://phpjs.org/functions/strtotime:554than you could hack up in a
> >>>> week (although you are an elite programmer). Just because it's being
> >>>> tested & improved upon by so many people in different environments.
> >>>> Reporting problems is as easy as making a comment, and 270 different
> >>>> authors have shared their code, ideas & solutions.
> >>>> As with any open source project we try to get better & better using
> >>>> hard labor, unit tests, and encouraging people to contribute better
> >>>> code.
> >>>> If you've taken our htmlentities, indeed discovered issues and
> >>>> improved it with your own fixes, you should really consider
> >>>> contributing those back.
>
> >>>> Best whishes,
> >>>> Kevin van Zonneveld
> >>>>http://twitter.com/kvz
>
> >>>> > > > > --
> >>>> > > > > You received this message because you are subscribed to the
> >>>> Google Groups
> >>>> > > > > "nodejs" group.
> >>>> > > > > To post to this group, send email to nod...@googlegroups.com.
> >>>> > > > > To unsubscribe from this group, send email to
> >>>> <nodejs%2Bunsu...@googlegroups.com<nodejs%252Bunsubscribe@googlegroups. com>
>
> >>>> > > > > .

> >>>> > > > > For more options, visit this group at
> >>>> > > > >http://groups.google.com/group/nodejs?hl=en.
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "nodejs" group.
> >>>> To post to this group, send email to nod...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to

> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/nodejs?hl=en.
>
> >>>  --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "nodejs" group.
> >>> To post to this group, send email to nod...@googlegroups.com.
> >>> To unsubscribe from this group, send email to

> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/nodejs?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "nodejs" group.
> >> To post to this group, send email to nod...@googlegroups.com.
> >> To unsubscribe from this group, send email to

> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/nodejs?hl=en.

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

Mariusz Nowak

unread,
Aug 4, 2010, 3:22:26 AM8/4/10
to nodejs
I think php.js may be useful for pre PHP developers as reference.
Through this lib they can answer many questions like "How to do this
with node.js ? In PHP it was so damn easy!". I helped myself that way
when I was working with Ruby (http://railsforphp.com/ )

However I would strongly discourage any serious/real project usage of
that lib. You didn't come to node.js to still stick with PHP don't
you?

Please, be wise and try to learn, better and more well thought
programming.
Reply all
Reply to author
Forward
0 new messages