Nice way of using Angular & PHP & Bootstrap & jQuery
-
>As of PHP 5.4 it is possible to array dereference the result of a function or method call directly. Before it was only possible using a temporary variable.
PHP! *shakes fist*
-
As of PHP 5.4 you can also use the short array syntax, which replaces array() with [].
Yes! Exactly what I wanted!
I love that I have
strpos
andstr_replace
in the same standard library. And how parameter ordering is something I have to look up every fucking time because it's never the same in two similar functions.I love that some array functions return a new array while some operate on one of the parameters. I especially love it how, when the first array you pass into
array_merge()
is empty, the result is always empty. But if you pass it as a second parameter it merges properly.I love that some stuff returns
FALSE
on error while other stuff throws undocumented exceptions that I can do shit about other than shrug and returnFALSE
myself, unless I want to spend hours triggering them myself in different ways and trying to collect error code meanings myself.I love it how I can't pass references to functions because that spews warnings about being deprecated, even though it's fully supported but I can only indicate that in the function declaration, so when I pass shit to it I have no indication of what I just passed to it.
I love it how you can use type hinting in function declarations. Oh, but only for arrays. Because it keeps thinking
string
orint
are actually classes.Keep adding that new syntax guys. Exactly what I wanted for Christmas.
*takes a deep breath*
I apologize for hijacking the thread but I had to vent. We now return you to your regular "JavaScript is shit" programme.
-
I was considering whether it might be worth learning some PHP*, as it might open some doors for me, careerwise. Of course, the downside to that is that I'd have to work in PHP...
*. It seems to me that learning PHP is essentially learning a long list of exceptions to reasonable behaviour you'd expect from a programming language, but I haven't really devoted much time to it...
-
*. It seems to me that learning PHP is essentially learning a long list of exceptions to reasonable behaviour you'd expect from a programming language, but I haven't really devoted much time to it...
This, pretty much.
There are some neat stuff in PHP, honest. But as soon as you start trying to do anything past "print HTML strings to compose page" it becomes a damned mess.
-
``` <?php ```</blockquote> Let's make a note that SCRIPTS are coming next so that people reading the webpage's source code don't get confused. And let's make sure that the SCRIPTS comment gets sent on every pageload instead of being part of the code that starts one line later.
-
I was considering whether it might be worth learning some PHP<sup>*</sup>, as it might open some doors for me, careerwise. Of course, the downside to that is that I'd have to work in PHP...
<small>*. It seems to me that learning PHP is essentially learning a long list of exceptions to reasonable behaviour you'd expect from a programming language, but I haven't really devoted much time to it...
Those are not doors you want opened.
-
I love it
I'm getting the feeling you might not be telling the truth, buddy. Do you need a bit of a lie down?
-
, the downside to that is that I'd have to work in PHP...
This is exactly why I refuse to admit I know it where recruiters can hear.
-
Status update. It wasn't the developers at fault here. The client was advised to upgrade their PHP version 9 months ago.
Now, that we haven't done any release to production in 9+ months is another WTF
-
Ah, wonderful production bugs when you don't test with HTTPS and do stupid shit like:
$scope.baseUrl = $location.protocol() + '://' + $location.host() + '/'; if ($location.port() != 80) $scope.baseUrl += $location.port(); // which gives you https://www.example.com/443
-
Typically, I don't think that's even code you want to have to write yourself?
-
Typically, I don't think that's even code you want to have to write yourself?
It looks like it was written in PHP, so...
-
No it doesn't. PHP doesn't use periods like that. I propose perl
-
It actually could be JavaScript:
$
is a legitimate identifier character, and.
is used like that...
-
Actually quite possible - on further thinking I'm not sure whether perl uses
$
like that.
-
-
Definitely javascript. Definitely.
$location
is apparently a wrapper ofwindow.location
so instead of doingwindow.location.port
you do$location.port()
-
Thank god! If I'd had to type
window.
one more time, I might've had to shoot somebody in the face.
-
Well.. that is if you had to type window. If you just type
location.port
the scope is assumed to bewindow
and you get back the same result.
-
so
$location.port()
is an abbreviation for...location.port
?
-
exactly.
looks like it was written by a java programmer couldn't stand javascript. They probably make get/set methods that require calling as getPropertyName() in all their C# code too.
-
There's an uncountably infinite number of ways that terrible programmers can take existing code (of any quality), and make it worse...
-
so $location.port() is an abbreviation for... location.port?
From what I have gathered from looking at Angular a little bit, I would guess that the$location
is from Angular's dependency injection; it means that a mocklocation
could be substituted during testing.But that's a guess.
-
it means that a mock location could be substituted during testing.
Guessing that it's for headless testing, as there wouldn't be much point to setting the location to somewhere your browser is not actually at, since actually setting the window.location navigates there...
-
Yes, also the title is a clear indication. And this is normal in Angular since
$location
is injected in that controller. But that's not the WTF, no.
-
No, it's the Angular way.
-
I mean, it's not like that would even work for HTTP hosting on 8080. Looks like it was Discotested!
-
Protip: PHP doesn't use
+
for concatenation (it uses.
).The only reason you should know that is because it's one of the few things mentioned in the three-page book that is "PHP - the good parts".
-
the managed to pad that out to three pages?
or are you counting the title page and the index?
-
No, it's multilingual.
-
Speaking of which, JavaScript: The Good Parts is 176 pages. It is just one line translated into every language that has been and ever will be?
-
Hmmm... coincidence?
PHP: The Good Parts
Delivering the Best of PHP
By Peter MacIntyre
Publisher: O'Reilly Media
Final Release Date: April 2010
Pages: 178Oh wait!
Print & Ebook: $32.99
TRWTF!
-
I was joking! It exists?
Ok, I gotta read that now!
-
Interesting suggestions:
-
I wonder what is in paragraph 1 of the third book.
"If you're using PHP, stop." ?
-
PHP: The Good Part
-
The idea of printing books about programming languages is beyond me. Somwhere in Burkina Faso there is a warehouse full of 'Learn HTML 3.0' and 'Mastering Borland Delphi 1.0' volumes.
-
The idea of printing books about programming languages is beyond me. Somwhere in Burkina Faso there is a warehouse full of 'Learn HTML 3.0' and 'Mastering Borland Delphi 1.0' volumes.
And that's why most of my reference books are e-books these days.
-
And that's why most of my reference books are e-books these days.
For bonus points, they have a working search functionality!
-
-
Well, there was a time where eBook readers didn't exist and reading on a laptop on your bed is not optimal for everyone.
-
Oh please God no!!!!
$curl -I http://clients.server.com/
HTTP/1.1 200 OK
X-Powered-By: PHP/5.3.3$curl -I http://our.dev.server.com/
HTTP/1.1 200 OK
X-Powered-By: PHP/5.4.33??? Even PHP 5.4 is outside "Active Support" so you shouldn't still be using it, let alone 5.3.
No it doesn't. PHP doesn't use periods like that. I propose perl
Perl doesn't use periods like that either. Where do you think PHP got its
.
string concatenation from? And PHP's$
sigil comes from a common ancestor too:whether perl uses $ like that.
-
reading on a laptop on your bed is not optimal for everyone
Of course not. I don't have a bed in my office. (Massive oversight, I know…)
-
When all was set and the files were in their place, all we got was a nice white page
Derek And Clive 'Come Again' - Full Album – 1:16:38
— georockable
-
Somwhere in Burkina Faso there is a warehouse full of 'Learn HTML 3.0' and 'Mastering Borland Delphi 1.0' volumes.
Burkina Faso? Shit, you can probably still find 'em at Barnes & Noble or Fry's.
-
There's probably at least one of those in the random book cupboard in my office.
-
Man, I was not joking. I once ordered some 20 copies of a book printed in the 70'. They were still available around 2002 only because someone had an entire warehouse of them somwhere in Cambodia. They reeked really bad too...
-
Man, I was not joking.
I totally believe you. I just meant I've actually seen books like that as recently as a couple of years ago, in a major city in the US. Because apparently nobody wants to charge off the cost of the inventory.
-
Maybe someone counts on them gaining historical value? :)
-
Anyway, I also hate programming books because where I'm from, the publishers can't get their shit together and typeset them in a readable way. Not to mention the poor quality binding which causes your 650 page book on AJAX to fall apart two days after purchase.