« first day (1471 days earlier)      last day (3472 days later) » 

Rao
4:03 PM
How do I extract just the $1 from this string replace statement ? url = yturl.replace(
    	        /(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=))([\w\-]{10,12})\b[?=&\w]*(?!['"][^<>]*>|<\/a>)/ig,
    	        'http://www.youtube.com/embed/$1');
 
what?
 
Rao
I mean, I am matching youtube ID and its being replaced with $1
'http://www.youtube.com/embed/$1'
 
put it step by step, you have a url from youtube, right?
 
Rao
I just want to get the value that matches $1 in a variable
yes
 
buahahahhaha
why not split ?
if you that your thing is coming from youtube ?
 
Rao
4:06 PM
I have something like this, var yturl = 'http://www.youtube.com/embed/mUFjk48df';
and then the above code,
I just want to extract ID part of the url,
 
!!> var a = document.createElement('a'); a.href="http://www.youtube.com/embed/mUFjk48df"; a.pathname
 
@darkyen00 "ReferenceError: document is not defined"
 
ah :'(
bad bot
 
Rao
I already have the regex that matches the id and does a string replace
 
var a = document.createElement('a'); a.href="http://www.youtube.com/embed/mUFjk48df";
var path = a.pathname;
 
4:07 PM
!!tell rao google js url operations
 
path = "/embed/mUFjk48df"
then regexp from here :D .. if you really want, i'd just split by '/' and use the second one
 
@darkyen00 no regexp, substr ftw
 
much regular.
 
Rao
my regex works perfectly
 
4:08 PM
@Rao then we might not be of help
 
Rao
I am able to replace the matched ID in the $1
but I also want the matched value in a variable
 
...googlepls
 
!!tell rao mdn RegExp#match
 
@Rao i wonder how do you handle youtu.be ? oh nvm
jeesh
 
Rao
4:11 PM
@darkyen00 I have considered that as well
 
don't be a moron and use the inbuilt tools
 
@AwalGarg don't be a less on
and give him half baked solution
youtu.be/j4dMnAPZu70 < won't parse this
 
Rao
4:12 PM
var ID = yturl.match(/(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\‌​/v\/|\/watch\?v=))([\w\-]{10,12})\b[?=&\w]*(?!['"][^<>]*>|<\/a>)/ig);
 
@darkyen00 practice makes me perfect
 
Rao
this should just give me id right ?
 
@AwalGarg you aren't practised enough
@Rao hope so
 
@darkyen00 I meant I practice like that so I get perfect
@Rao it would give you a error
 
you practice like that ?
!!google spelling of practise
 
@BenjaminGruenbaum Promise question:
 
@SecondRikudo he promises he will give you a question.
 
Say I have an array I need to asynchronously map to a different array (for example, search google on the strings, and map the old search terms into an array of results)
 
Are you using bluebird ?
 
How would you do that? Would you edit the original items array from the external scope? Can you pass it in somehow?
@darkyen00 I am
 
4:17 PM
gimme a second i know this one.
does that suffice you ?
 
Rao
I am actually matching the complete url with this regex, how do I modify it to match just the id part?
/(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch‌​\?v=))([\w\-]{10,12})\b[?=&\w]*(?!['"][^<>]*>|<\/a>)/ig
 
stop pasting that regexp
 
@darkyen00 I don't have an object though, I have an array
 
its making me scared
Promise.all([
    ping("ns1.example.com"),
    ping("ns2.example.com"),
    ping("ns3.example.com"),
    ping("ns4.example.com")
], 2).spread(function(first, second, third, fourth) {
    console.log(first, second);
}); ?
@SecondRikudo does that help ?
 
4:20 PM
!!> "https://www.youtube.com/watch?v=dQw4w9WgXcQ".split('v=')[1].split('&')[0]
 
@darkyen00 Given an array of search term lines, map it to Google results for each search term line.
 
@rlemon "dQw4w9WgXcQ"
 
if not throw me some code example, i wanna nail this shot.
 
!!afk running around
 
@rlemon won't work with youtu.be
 
4:22 PM
@darkyen00 that's a slightly simplified example
My actual problem is: take an array of strings, in each string find all image urls, upload all images to imgur, replace original image urls with imgur urls, map to the original string in the array.
 
Promise.map(googleKeys, function(token){
    return GoogleAysnc().then(ParseJson);
}).then(console.log.bind(console));
if that is what you want. ... though i doubt
 
HTML form submit not calling Javascript "onsubmit" handler in Wordpress post
I am facing this issue, can someone help me?
I have a basic HTML form with a submit button at the end. Problem is, the Javascript function I have provided as "onsubmit" handler in the form header is not being called.

<form name="Details" method="post" onsubmit="validateForm()" id="Details_Form_ID">
This handler function is defined in the same file as follows:

<script type="text/javascript">
function validateForm() {
alert('I am an alert box!');
}
</script>
When I look at code in Chrome tools, I notice that the above Javascript code itself is wrapped under a p (paragraph) element and not shown as a "script".... I suspect that the Jav
 
Promise.reduce(googleTokens, function(dict, token){
   return GoogleAsync(token).then(function(jsonData){
               dict[token] = jsonData;
   });
}, {}).then(function(hashOfTokenAndResponse){
    console.dir(hashOfTokenAndResponse);
});
@SecondRikudo best what i could think.
 
I think that first one is basically what I need
Promise.map(...).then()
 
ohky :D
i like dictionaries
 
4:29 PM
If I pass null to Promise.map as the first argument, will it do anything?
 
try it unicorn riding ninja
 
@darkyen00 Setting up a bluebird fiddle is a pain
 
+1
 
There's no CDN with the proper version
 
am off...
 
4:32 PM
Yeah it blows up
 
I might hurt people, if i get any more furified.
so better that i just go on a walk... calm the hell down
 
so, I have a background image in an html file, which should cover a whole element
 
@HatterisMad This is very sad news.
Also latest reply ever.
 
I want it's width to be the same as the element's but I want to repeat the y, and it's height should change based on it's width
I tried:
background-size:100vw;
background-repeat:repeat;
but nope
the image does not repeat
 
@towc Y U NO FIDDLE?
:P
 
4:37 PM
I thought it may be because background size is setting both width and height, and in fact the height of the image is exactly my viewport, then it stops
let me make the fiddle
 
@darkyen00 can you give me some direction on this stackoverflow.com/questions/26564146/…
 
Rao
All sorted out, I wasn't thinking straight.
 
@AwalGarg this is the whole thing. Let me make a fiddle for the specific case now, but the code is pretty clean I think. Look at body::after towc.eu/game
 
wat!
 
@AwalGarg ?
 
4:43 PM
@towc those buttons at the top bar
why do they resize with height change?
 
@AwalGarg uhhh...
I'll fix it later
so... made a fiddle, but it works...
dahell?
 
@towc welcome to the club of ppl-who-write-code-not-working-in-code-but-in-fiddle
@towc do you know you can use the debugger to debug css too?
 
@AwalGarg yes
which is what I'm doing
 
pro-tip: when such things happen with css, check if you haven't uglified the box model
 
and I found out that body::after doesn't have the same size as the body
 
4:52 PM
indeed
 
even tho I did this
top:0; bottom:0;
left:0; right:0;
I'm utterly confused
 
@towc but why are you applying that to a pseudo element? Why not apply the background straight to the body?
 
@AwalGarg because I want to add an opacity to the image
I could do that using an image editor
but I find it easier to do it with css
and I'm not aware of any background-opacity
I could theorically use a filter, but urgh
if there was a page height unit in css I'd be using that and everything would be so simple
but nope
and I don't want to use any form of js for something such simple
 
Can i ask a question about eval ?
 
I could also use position:fixed, but that isn't what I wanted, but could still be cool
@darkyen00 I didn't expect you to ask if you can ask
 
5:01 PM
@towc eval :P
what is the scope of eval ? and can i somehow scope eval ?
or eval just basically adds a <script> tag ? (Ie run it in global / self / window scope? )
 
@darkyen00 I once saw this:
function genEval(str){(new Function(str))()}
 
@darkyen00 global scope, for sure
@towc it was me
 
it probably goes with the same rules
@AwalGarg oh, right
 
Oct 18 at 18:06, by Awal Garg
!!>var evaled = new Function('return' + "[1, 2, 3, 4]")(); console.log(evaled);
 
!!>var evaled = new Function('return' + "[1, 2, 3, 4]")(); console.log(evaled);
 
5:04 PM
@darkyen00 "undefined" Logged: [1,2,3,4]
 
@darkyen00 don't you need a space between return and the array?
!!> (function(){return[1, 2, 3, 4]})()
 
@towc "SyntaxError: return not in function"
@towc [1,2,3,4]
 
@towc why?
 
uuuh
@AwalGarg I always thought you did
 
@towc you don't, but you want
nobodylikestoreadthingslikethis
 
5:08 PM
can you only do that with arrays?
also with objects
and strings
wow
 
houdy
 
I still feel like there's much missing (not the games, the page design itself) towc.eu/game
I should add my name in there somewhere
also, I don't like the position of that Games header, doesn't feel good
 
!!>typeof return
 
@AwalGarg "SyntaxError: syntax error"
 
@AwalGarg @erikroyall don't watch youtube.com/watch?v=CLY-QrB6hg0
!!google ES5 annoted return
 
@darkyen00 poisoned?
 
seems so
 
that's awful to watch
 
...lol statement for some reason completely slipped through my mind
 
it returns what you want in a function for example return a*b
 
5:16 PM
@rlemon woah thats pretty cool
 
@Loktar rlemon is afk: running around
 
@Loktar wait so... now we'll able to get virtual keyboards?
 
Can anyone give me a link to read about time fixed delays? I tried settimeout,setinterval etc...
 
this is awesome: when you'll be able to connect the VR to an iphone-sized deviced, and get a foldable hand exoskeleton nobody will need a real computer anymore
@user3470815 why not those?
 
@towc imagine your brian connected to cloud
directly ?
 
5:19 PM
@darkyen00 who needs a social life anymore?
 
...we are already living on the internet
 
The thing is setTimeout & setInterval stop the current block code where they are, but the rest of the script goes on..
 
@AwalGarg as in
when internet will be just another native organ to your body
 
@user3470815 then do something like this:
code block 1;
setTimeout(function(){
code block 2;
}, delay);
there is no 'sleep' in js
 
@AwalGarg as in thinking about Array.reduce defines every single edge case of Array.reduce for you
 
5:21 PM
i tried with anon functions
 
and you don't even have to google it :P
 
@darkyen00 eh... no. I would not like having that...
 
@towc ill think about it, but how the whole script is "designed" you need the output of block 2 to run block1 so putting block 1 at the begining isnt an option at the moment -Maybe i should redesign the code..
anyways thanks
Im trying to make a "dirty" kilobots simulator using html table cells
 
@user3470815 what? Why?
 
by dirty i mean not good graphics
its a project
 
5:27 PM
@user3470815 use canvas
uh! this guy solved the touch type in the VR WebGL environment IDE
 
Yeah i know canvas would be the way to go... but i never used canvas and im not going to have time to learn it when the deadline date for the project
 
learn how to learn code, then learn how to read code, then learn how to write code, then learn how to code good, then do what you are doing right now.
 
cool video
 
Is there a way in javascript
where you can get the number of threads/ workers a tab has ?
 
!!>javascript
 
5:32 PM
@AwalGarg "ReferenceError: javscript is not defined"
@AwalGarg "ReferenceError: javascript is not defined"
 
...such a fantastic error that is :D
 
@AwalGarg edcuate me how ?
 
@darkyen00 it says javascript is not defined, what else?
 
@Aw
 
oH i thought you intended to reply me @AwalGarg
 
5:36 PM
@AwalGarg fiddle it
jsfiddle.net
 
@user3470815 eh, are you alright?
 
doubtful.
 
^ ^^
 
^ ^^ ^^^
 
i meant to fiddle what gave you that error
 
5:37 PM
lol
@user3470815 dude...
 
oh it was the bot..
sorry i was multitasking... and tought you got that error
 
(function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {LinkshimAsyncLink.swap(this, "http:\/\/www.imdb.com\/name\/nm1822623\/");
from facebook.com
 
!!should I organize my to-learn list or not?
 
@AwalGarg You should organize my to-learn list
 
@darkyen00 wuuuuut?
 
5:41 PM
!!should I also implement the to-learn list or not?
 
@AwalGarg You should also implement the to-learn list
 
you damn bot!
 
!!god or damn
 
@towc damn
 
@AwalGarg you're wrong
 
5:43 PM
now am I?
 
mmm.. could you point a web to read about fixed timesteps delays
 
wat
 
could you point a gun to my head an pull the trigger ?
 
bang!
 
dies
 
5:44 PM
...
 
@user3470815 ...see what you did!
 
imagine a game by turns.. now image a delay for changing turns
and move of a player on the grid each timestep
 
function -> settimeout -> function recursion -> boom!
 
.. I already tried that @AwalGarg and it worked alone, but not when inside of a couple of for blocks
 
even more terryfying
 
5:48 PM
19 mins ago, by Awal Garg
learn how to learn code, then learn how to read code, then learn how to write code, then learn how to code good, then do what you are doing right now.
@darkyen00 o_O I thought you were dead!
 
function mecawento(origen,destino){
//origen
pintacasillaverde(origen);

setTimeout(function () {

pintacasillablanco(origen);
// your code here
pintacasillaverde(destino);//destino


}, 500)

}
 
@AwalGarg i am metalhead
came back to life
 
that one didnt work inside a couple of fors, but this one did work standalone:
function recorreFila () {
setTimeout(function () {
pintacasillab(1,i);
// your code here
pintacasillav(1,i-1);
i--;
if (i > -1 && i!=0) {
recorreFila();
}
}, 500)
}

recorreFila();
neither making the first one recursive like the 2nd one
I think ill get it to work but ill take a time...
anyone uses sublime text?
what does a ? mark mean on the line number side
 
@AwalGarg yes, it's a common function, and it's a nice introduction for closures
 
6:03 PM
kk
 
should setTimeOut work inside a for loop??
 
Phaser or Pixi for an Canvas engine?
 
@NoahHuppert I'd just write it with regular JS
It's not that hard...
 
6:27 PM
Hows HTML5 Canvas Perf on mobile?
 
Don't expect miracles
 
Yea... What I thought, was wondering if any Engines had optimized that.
 
heavy vegetable + low grain diet === very regular :s
#protip
 
iOs loves smooth graphics
but they can't really outperform a PC
 
I plan on putting here all of my (code) pens with 400+ views. Am I just crazy or could be worth it?
(24 pens as of now)
 
6:36 PM
i propose you build something like that for christmas :D
snowfall.js 3d :D
 
@towc Yes
@towc That's almost impressive
 
@copy yes to which?
 
cool @darkyen00
 
@copy o/
 
@towc Put all your code online
 
6:48 PM
@copy = bad thing?
 
Good thing
 
:D
ok
 
30 / 30 / 6 / 70 / 1
siezure garunteed
 
@darkyen00 wut? my brain!
!!afk dinner
 
did you really write it like this ?
c=b=0;a=d=-1;e=[f=[20,7]];q='~e.join(e+"").indexOf(e+';setInterval('c&&40==a|38==a&&(c=0,d=a-38?1:-1);d&&37==a|39==a&&(d=0,c=a-37?1:-1);'+q+'[i=e[0][0]+c,j=e[0][1]+d])|!i|39==i|!j|10==j?b+=" | GAME OVER":(e.unshift([i,j]),'+q+'f)?f=[g=new Date%38+1,g*++b%9+1]:e.pop());for(l=h="";11>h;h++){for(g=0;40>g;)k=g+","+h,l+=!g|39==g++|!h|10==h?"X":e[0]==k?"O":'+q+'k)?"*":f==k?"%":" ";l+="\\n"}c|d&&(x.innerHTML=l+b);+b||(c=d=0)',99);onkeydown=function(n){a=n.which}
like seriously ?
 
6:58 PM
No
Like sarcastically
 
i mean thats insane to the next level.
what is he, a minifier ?
 
btw, everyone should be getting a screen like this:
If it's not the case please tell me
I noticed that on my father's computer you only have 1 column, which looked pretty bad
oh, fixed
 
7:31 PM
@darkyen00 look at codegolf.stackexchange.com
 
7:42 PM
I am an idiot: rather than copying my pen's code and upload it to my server, I could have just linked to the pen itself -_-
 
:D
Promise.map(matches, imgur.uploadUrl)
 
the way I'm doing it can make me sure that the code will always be somewhere, and the page will probably lag less than the pen, but linking to the pen could have given others more attention to my account, and would have also been a helluvalot easier
 
imgur.uploadUrl returns a Q promise
Promise is bluebird's promise object
Will bluebird convert it to its own promise object?
:P
 
7:57 PM
Anyone?
 
#Congratulations to Robert Lemon (@TheGreatRupert) for #HappyHalloween: http://codepen.io/rlemon/pen/fGyJL #HauntedCodingWeek http://t.co/FN7AtqYsxN
2
nifty
 
8:13 PM
codingUK: he's canadian, but nvm :P
 
8:32 PM
 
@Neil dafaq did I just read?
 
@SecondRikudo star wars, you heard of it?
 
@Neil Yes... I refered to the "Be like Han" thing, WTH? XD
 
@SecondRikudo you remember that scene?
 
Hazily
 
8:37 PM
that was right before darth vader force pulled his gun away
han's first reaction was to shoot
 
I watched these movies like 10 years ago when I was twelve and that's it.
 
9:02 PM
@devdar If you have that many dependencies, you are doing something very very wrong.
Please don't paste huge chunks of code
Use a paste service instead.
 
@SecondRikudo ok no problem can you explain in a little more detail where i am going worng
 
@devdar You have one module that uses 20 others
It's an indication that the module is doing way too much.
The entire idea of modules is that each does a little piece of the job, and they add up to perform the complete task eventually.
 
@SecondRikudo that code was creating a datagrid
@SecondRikudo what i am trying to do is set the grid datasource from an external call
@SecondRikudo if i leave the aliasData and aliasStore in a global scope its easy to change their contents and have it reflected on the grid however i know its not a good idea to have variables in a global scope.
 
nooooooooooooooooo
first time Brackets has crashed on me
 
@SecondRikudo i am really looking for a way to remove them from global scope and have them locally however its a pain when trying to modify the contents
 
9:27 PM
I can't believe I've done so many little cool things in my life! towc.eu/demo/index.html
time to sleep :/
I'll add more demos later
 
9:41 PM
Mornin' peeps
 
http://github.com/SFTtech/openage
open source aoe clone
 
9:58 PM
@Zirak yes. It's very annoying.
but your response was reasonable and measured
 
10:13 PM
PhaserJs, How would you resize the stage when the window resizes?
 
10:38 PM
jalapeno stuffed olives <3
 
10:55 PM
@rlemon nice job on the halloween pumpkin!
 
@SterlingArcher i.imgur.com/UEpxDdZ.gif .
 
lmao
that was unexpected
 
and thanks bro
funny story, I wrote that last year. didn't even submit it
they emailed me and asked if they could use it
I suppose 'use it' === 'win an award(?)'
 
posted on October 26, 2014

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker("UA-3727700-1"); pageTracker._trackPageview(); } catch(err) {} Thanks everyone for a glorious BAHFest West! Many people asked when

 
@Feeds eh?
not that good
 
11:08 PM
what a brilliant man
 
so much better than matt smith
I love that we live in an age where we can see a storm on another planet
 
11:52 PM
Technically we've been able to do that for over a century
Jupiter's Red Spot has been know for a very long time
 
hello
 
Greetings
 
is there a way to use SetTimeOut() / setInterval in a way that it would not continue executing code outside the blocks they are in until the delay finishes?
I know there is no real sleep in JS..
 
No
 
ok thx @copy ill have to redesign the whole code...
 
11:58 PM
Promises might help
 
What do you mean by promises?
 

« first day (1471 days earlier)      last day (3472 days later) »