« first day (925 days earlier)      last day (4039 days later) » 

4:00 PM
hey i'm testing website on mobile using: <meta name="viewport" content="width=950,initial-scale=0">
 
the site is 950px width
but on mobile it results little bit cutted on left and right margins
may i need viewport intial width more than 950 ?
or less !?
 
@FlorianMargaine there's the fiddle
 
@Christopher that should work. Check for typos and if the JSON is as intended
 
4:03 PM
@JanDvorak An example of the JSON that is being returned is in the fiddle. It looks right to me.
 
@Christopher perhaps data is already parsed?
 
hey dudes noone can help me? :D
 
@Christopher sorry, misread the JSON. Try newdata["0"].InvitationSent
 
@rlemon What was this in reference to?
 
:This is about the narrative poem by American writer Edgar Allan Poe. For other uses, see The Raven (disambiguation) "The Raven" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further instigate his distress wi...
 
4:05 PM
@Christopher any idea why the top-level object isn't an array?
 
is it bad practice to use div align=center?
 
yes @Sebastian
forgot align="" forgot it
use css
 
@JanDvorak What do you mean?
 
@okok Thats what i thought
 
you were right
 
4:07 PM
@okok =)
 
ehehe
 
@Christopher the JSON is {"0":{...},...}. Why is it no... nevermind, there are non-numeric keys.
 
@Sebastian there are tons of html attributes deprecated or to nto use , the best you can do do it in css always
html attributes are mostly used for js
 
@okok Ok thanks i'll keep that in mind
 
;)
 
4:09 PM
@Christopher the object in the JSON doesn't have an InvitationSent property, but its 0 does.
 
@JanDvorak I see that now, thanks
It is working as intended
 
@rlemon ...nevermore
 
hi,can i do this way: $query = $db->prepare("SELECT id FROM users WHERE email = ? AND registercode = ? LIMIT 1");
 
@XCritics 1.97
 
4:12 PM
@OctavianDamiean huh?
 
Oh nice!
 
@Olli that doesn't seem to be valid javascript. Is this PHP?
 
I'm going to crack the 2.0 soon.
 
@JanDvorak undoubtedly or C++
 
4:13 PM
I never played BF all day yesterday, I spent the whole time, up till this very moment trying to fix this animation in my game
and still haven't fixed it x.x
 
@Darkyen I've never seen PHP-style naming convention used in C++. Moreover, I thought that references were preferred over pointers.
 
@JanDvorak yes,i post it here,since no PPL in JS room
 
@JanDvorak i have seen one person does so
but well he was an idiot :P
 
@Olli there seem to be 29 people here; did you mean the PHP room?
 
he did _$ lol, dunno how he managed to compile though ... mine always throws errors
 
4:15 PM
@Jan,yes i'm sorry
but could you answer the actual question
 
but "->" reminds me of c/c++ a lot
 
@Olli do I understand correctly you're storing passwords unencrypted?
@Darkyen -> is also valid in coffeescript
 
user1125394
-> tell me erlang
 
bah hambug i never use the caffe iscript
 
4:17 PM
I think $db would be called with a function returning prepare(...) as its argument, if it were coffeescript
 
btw i found out how to decide if the pixels are to be animated :D , using Quad Trees
 
@Jan of course not. registercode is used when people registers, only once.
then person will choose pwd
 
@Olli then the logic seems fine
 
@rlemon hehe, cute
 
Actually, $query = $db->prepare(); is invalid coffeescript. $query = $db ->prepare(); calls $db with a function that calls prepare()
 
4:21 PM
Did you see the bash.org one? bash.org/?120296
 
user1125394
only way to get the post protocol part of an anchor is url2.href.substring(url2.protocol.length)?
 
@JanDvorak okth
x
okthx*
:)
 
@c'c what about using url2.protocol directly?
 
user1125394
I need to change a ws or wss in http or https respectively
 
user1125394
4:31 PM
yes butI don't want to change the object
 
user1125394
that is used in loop and can be used later without the change
 
strings are immutable in javascript
url2.protocol looks like a string to me.
 
user1125394
but the HTMLAnchor no
 
user1125394
I need the full url replaced
 
Strings are immutable by definition, just like "2" is immutable
(that is, the number 2)
 
4:33 PM
@BenjaminGruenbaum use backticks ;-)
 
It'd be better to say that strings are value types in JavaScript
There are no backticks on an English keyboard
 
@BenjaminGruenbaum what kind of english keyboard do you have?
 
US layout?
Where are the backticks located?
 
user1125394
url2.protocol = {'ws':'http', 'wss':'https'}[url2.protocol] <- change url2
 
Wait a minute, holy shit a
 
4:34 PM
I've got backticks to the left of 1
 
The tilda key
it's a backtick :O
Holy mother of fuck :P
 
Uhm, wait, what are you trying to do? @c'c
 
With shift, it's a tilde
 
Do you know how much I looked for them?
 
4:35 PM
Yeah, I use tilde lots, but never used that key without a shift in my life -_-
 
...
 
o-0
 
That noob feel
 
user1125394
@OctavianDamiean ws://foo/bar -> foo/bar, without changing my url2 object
 
I can't believe it --, there was a _key on the keyboard I was completely unaware of
 
4:35 PM
Hopefully you didn't write in a language needing backticks...
 
markdown inline code block?
 
I didn't, I always thought it wasn't even ASII and only " and ' are, what languages require them?
 
@BenjaminGruenbaum I felt nooby when I realised that arrays in ruby have grep, so they don't need map to accept a regex argument :-)
 
backtick
 
4:36 PM
@Shmiddty I always used control+k
 
So you never used inline code blocks
 
@c'c "ws://foo/bar".replace(/^ws:\/\//, '');
 
When you write macros in lisp, backticks are necessary
 
I feel like there is a catch.
Something I'm missing. :D
 
@JanDvorak grep ruby = filter javascript right? I haven't done ruby ever since it became cool
 
4:38 PM
["1","a","cc"].grep /..+/ => ["cc"]
 
@FlorianMargaine WTF I'm such an idiot, I knew DVORAK had backticks, I just never assumed QUERTY had them at the same place -_-
 
@BenjaminGruenbaum how do you know DVORAK has backticks?
@BenjaminGruenbaum it's even painted on the key ;-)
 
@c'c It wasn't that simple, was it?
 
From using it for a while a while back
@JanDvorak Yeah, like ["1","a","cc"].filter(function(elem){ return /..+/.test(elem);})
 
user1125394
@OctavianDamiean hmm not bad and taking wss -> https into account, another chain?, (I want something fast also)
 
4:40 PM
There is a nicer bindy way
 
@BenjaminGruenbaum please use the backticks ;-)
 
man I should give Dvorak another shot. I wussed out
 
@Zirak It was good for a while but I had to share every keyboard but my desktop's and it because a hassle
 
user1125394
@OctavianDamiean isn't that possible to use the replacement object {'ws':'http', 'wss':'https'} ?
 
Javascript: ["1", "a", "cc"].filter(function(e){return /..+/.test(e)})
 
4:41 PM
@c'c "ws://foo/bar".replace(/^ws+:\/\//, '');
Oh wait!
You don't want to just get rid of the protocol part you want to replace it?
 
Also, I was a worse programmer back then and thought typing speed was important ,typing speed is never really a limitation as long as you're good enough
 
Ruby filter: ["1", "a", "cc"].filter {|e| /..+/ =~ e}
 
user1125394
@OctavianDamiean replace ws with http and the other
 
Ruby grep: ["1", "a", "cc"].grep /..+/
 
user1125394
4:42 PM
need to capture the (s)
 
@JanDvorak Yeah, I'm starting to remember, I really liked Ruby when I worked with it
 
user1125394
but regex are known to be slow
 
//JS grep:
Array.prototype.grep = function(regex){
   return this.filter(function(elem){
       return regex.test(elem);
   });
}
Gotta love that about JS, how easy it is to extend :)
 
@c'c Well, you can just check for the third character in the URL, if it is an s, you have https if it is a colon it is http.
 
Ruby allows monkey-patching as well
 
4:44 PM
Yeah
 
That's the quickest I could think of without using regex.
 
Also, blocks are a lot of fun
 
user1125394
!!> "ws://foo/bar".replace(/^ws(s?)/, 'http$1');
 
@BenjaminGruenbaum Do you know the &: operator?
 
@c'c "https://foo/bar"
 
4:45 PM
@c'c Didn't you say you wanted to avoid regex? :D
 
@c'c "http://foo/bar"
 
user1125394
@OctavianDamiean bah..
 
@JanDvorak Yeah :) It's just syntactic sugar though iirc
It's relatively new thouh, I used to meddle with Ruby longer ago
I liked it, pretty much for the same reasons I like JavaScript, I like JS better but Ruby is a lot of fun
 
0
Q: Works, help clean up code

Vinh TranThis JavaScript code works but I do not think it's coded cleanly, can anyone help clean it up? This code is for the back-to-top feature, when user gets to the bottom of the page, it scrolls them back up to the top when clicked on In the index page; <ul class="nav nav-pills pull-right"><a id="ba...

 
["1", "a", "cc"].map(&:length) => [1,1,2]
You can enable that in older versions of ruby by patching Symbol
by implementing Symbol#to_proc, to be exact
 
4:48 PM
["1", "a", "cc"].map(x => x.length); // => [1, 1, 2]
ES6 ^
 
You can enable this in JavaScript by adding a length method to strings, or by adding a pluck method (kind of like what underscore does)
 
@FlorianMargaine Looking forward for Harmony's =>
 
especially for codegolfs, heh?
 
I use it in C# all day long :P
 
function is effin long to write...
 
user1125394
4:49 PM
ES looks cool, need to know how it's used in your browser
 
I should do more Ruby, I'm having issues with Python where it does stuff in ways that are not logical
 
even when not golfing
 
Whoever thought it was a good idea to stop iterators by throwing exceptions? -_-
 
I just love (x)->x*x. Ruby's {|x|x*x} comes close second.
@BenjaminGruenbaum do you know while ... else?
 
yeah, I like arrow notation becasue I'm used to it from Math :)
 
4:50 PM
Also, I love **
 
or if, you already have `var len = function(x){ return x.length; };`
['a', 'bb', 'ccc'].map(len);
 
@c'c That's kinda what I was talking about. url2[2] === ':' ? 'http' + url2.slice(3) : 'https' + url2.slice(4)
 
@JanDvorak Yes, and it is also something I implemented myself a lot of times in other languages, not I rarely do
 
Which is possibly part of the reason why functional languages are so concise.
 
be back later, bus stop
 
user1125394
4:51 PM
@OctavianDamiean ok, let's get rid of the regex :)
 
To be honest, I have no idea which one is faster.
I should create a jsperf for that just to find out.
 
Who ever thought that empty arrays should leave notices when iterated over? Because that's what happens in PHP
replace is often faster than repeated concatenation
 
user1125394
@OctavianDamiean if and slice would perform
 
What the hell, who cares?
 
4:57 PM
@OctavianDamiean ... wat?
 
@JanDvorak wat wat?
 
I did not expect a 1:10 difference
 
Oh yea, me neither.
 
From now on, I'd like to perf any regex I write against a non-regex solution
 
I mean I knew that capturing groups in regex are slow but not that they're that slow.
 
5:00 PM
@c'c Your regexp is weird
Why aren't you just doing url.replace('ws', 'http') ?
Won't the s carry over?
 
Ain't mine! Hit @c'c for that. :)
 
^^+1
 
And it's not such a surprise the regexp method is slow. You have to compile a regexp to execute it
But again, who cares?
It's much nicer than the slice mess
 
Updated the test case.
 
5:03 PM
@Zirak it should be parsed once, and then cached
 
So, the one using a capturing group is 20% slower than the simpler regex method, which is still 65% slower than the splice method.
 
Have you tried caching the RE?
Yeah, what @JanDvorak said.
It's a good idea to cache regexps, e.g. var rx = {foo: /.../, bar: /.../, ...}; near the the top of your code.
 
No
Make your code uglier only if you have a bottleneck
And don't use too many variables, it will make your program slower
 
No uglier than having named constants instead of magic numbers.
 
@FizzyTea shouldn't the parser do that for you?
 
5:08 PM
ugh, again, who cares? Something which can be run hundreds of thousands of times a second will not be your bottleneck
Your bottleneck is an inefficient combination of these things which, individually, can run a bagillion times.
 
user1125394
@Zirak oho, lol yes
 
@JanDvorak Probably.
 
!!/google bagillion
 
@Zirak Because it helps readability, IMO.
 
5:10 PM
Bagillion is an arbitrarily large number
 
And it matters in something like a lexer.
 
@FizzyTea That's a different reason, not a performance one
Again...if that's the bottleneck, fine, but in most cases, it's not, so it's stupid
 
@Zirak It's a different type of performance.
Caching definitely matters if you are doing perf measurements. You want a level playing field.
 
user1125394
!!> "ws://lol.ws/wireless/ws/".replace('ws', 'http')
 
@c'c "http://lol.ws/wireless/ws/"
 
user1125394
5:13 PM
oh, nvm
 
huh, there's roughly a 10MOps/sec difference between Chrome 26 and Firefox 20.
 
SC2 is hard >.<
I've never been good at the zerg
 
OOP stands for "Oh Oh! Poop!"
 
5:30 PM
@Zirak fwiw I'm pretty sure the engine caches regular expressions
 
@Zirak OMG OMG OMG, 2 days later, boiling-ravine-7274.herokuapp.com fixed ! And made a pretty scene.js
Any idea how to make the left and right buttons not have that initial delay when you press down?
 
@Shmiddty HoTS is MUCH easier than WoL
 
@XCritics Do you have that source code on github? My provider minifies JS (true story) so I can't read it
 
!!/define HoTS
 
@JanDvorak No definition found
 
5:31 PM
!!/define WoL
 
@copy github.com/Gacnt/FirstGame/tree/master/public/javascripts (ignore game.js and newgame.js they were just tests, supergame and scene.js are it)
@copy how can I make smoother movement left and right, like your IWBTC?
 
You remember if a key is pressed, and have a main logic loop. If the key is pressed in the logic loop, move the character
 
@copy Just beautify it with Chrome.
Don't you use Chrome?
 
Not usually, in this case yes, but I didn't know you could do that
The JS file is also inlined into the HTML file though
They do it so caching doesn't work, I have to use more bandwith and they can charge me more
 
@JanDvorak Heart of the Swarm, Wings of Liberty
 
5:36 PM
@copy so in my github.com/Gacnt/FirstGame/blob/master/public/javascripts/… drawPlayer function, have a loop thats constantly checking for which key is pressed down?
 
@copy It should still work.
 
@XCritics Essentially yes, but there are some gotchas
 
Gotchas?
 
Yes, you either make a seperate loop with setTimeout, or you use delta timing
 
When you are in the source tab and select a script or the page (in case it is inlined), just click the { } button.
 
5:41 PM
 
@BenjaminGruenbaum maybe I'm just too far out of practice
the mission where you have to spread creep to the things that shoot down the big goliaths... I've failed it like 3 times on normal
My favorite restaurant is no longer on grubhub >.<
 
@rlemon thats awesome
man I cant wait to get a pair
 
@copy So I made it A LOT smoother, but I have one problem, if I press left and hold, it works great, but if I quickly switch to holding right, he pauses, then goes, but if I wait half a second between going from left to right, he goes instantly all smoothly: http://boiling-ravine-7274.herokuapp.com/

And what a difference between smoothness by having it check in the interval
@rlemon boiling-ravine-7274.herokuapp.com :D Proud of me :D?
The new code copy is in the superGame.js
 
hello people
I want to ask simple question
how can i put a character in front of each upper case letter using js and regex ?
so if i had text
 
Chris Coyier is awesome
 
5:56 PM
AbssfsdDdsdsffsdDdsewfGhsf
I want this
Abssfsd Ddsdsffsd Ddsewf Ghsf
anyone ?
 

« first day (925 days earlier)      last day (4039 days later) »