« first day (1675 days earlier)      last day (3290 days later) » 

5:00 PM
Ok, question then: I have made a grid by using loops (imagine a chess board) and put all of the pieces in a 2D array. Now, I want to place turrets on it. So I need to create a onclick-event or anything like that. Now I was wondering how I should "create a turret" and place it ON the board? I was thinking of creating a new div with an image, but how can I put it on a certain piece? I'm a bit stuck there.
 
@ssube you mean something like a bank account but without the state enforced security ?
 
@dystroy and no guarantee on when you can get money out of it
 
user2862309
Ah, I forgot that there was such a thing as an inappropriate content/butt-hurt people
 
@Kryptonous Sounds like a job for <canvas>
 
banking like it was in mary poppins
 
5:01 PM
@SomeKittens or svg, which makes it easier to manage events
 
<label>custom checkbox content<input type="checkbox" style="display:none"></label>
 
@Kryptonous just put an id number/string in the 2d array, and for the rendering either use a table or canvas
 
libertarian banking, where nobody has money because you can't own things. Anarchy in the chatroom. shoots the ceiling
 
Store DOM elements in an array
 
If I'd use the canvas, should it overlap on the board with absolute positioning?
 
5:03 PM
so you do have a board?
 
Yes.
 
like, a table or just a background-image?
 
Gimme a sec... I'll grab a link
 
sure
 
That's the way how I made the board
now what I want to do is make a button. If I'd click that button AND THEN click on a piece of the board, a turret will be created there.
But I don't really know how I was going to do that, in order to "integrate' the turret in the board
 
5:05 PM
put transparent divs above your canvas
draw the board and the turrets on the canvas
use the divs for catching click events
 
you should have a separate array with the non-rendering data
 
it will make your life easier than handling input yourself
 
then just set the bg-image of the defined game-zone to be a turret image
or use canvas
 
the map will rarely change, same with turrets, so you can probably make a single canvas with that
if you need bullets, layer a second canvas on top and draw particles to it
 
Hehe, my javascript knowledge is ok, but really not that sophisticated. What do you mean by putting transparent divs above the canvas in order to handle the click event?
So if I'm correct: you mean I have to create 2 layers: one layer with empty divs (but in the exact same way I made the board with)? And then another layer with the images (like on the fiddle)
 
5:09 PM
Are before and after elements when positioned absolutely considered as children of their parents? I mean if I position the parent as relative, the top etc. properties applied to the pseudo element behave as if it was a child of the parent :/
 
or, if you can only have one tower per square, you can have the background as you do now and layer the tower divs above it
 
I thought the pseudo elements are placed adjacent to their parents in the hierarchy :/
 
"or, if you can only have one tower per square, you can have the background as you do now and layer the tower divs above it"

This is correct. So would I have to create another layer of the same grid and return true if a turret is created?
 
thats one way
you might have diff turrets, so maybe a numeric value instead of true/false
like 1's are bullet towers, 2's are mortar towers, 0's are nothing
 
use a CSS class for each type of turret and in your stylesheet, set up background-image to reference a spritesheet?
then you just setClass('turret-mortar') and the browser gets to do all the (complicated) fun
 
5:14 PM
or you could store an object as part of the square with a background property.
 
Yes, but I don't know how I put it on the board? If you looked at my fiddle, could I do it the same way I did with the road?
Ok, lemme recap...
 
same mechanics. You'd need a stylesheet like: div.ground { z-index: 1; } div.turret { z-index: 2; } div.turret.turret-mortar { background-image: url('turret-mortar.png'); }
 
thats from a random old project of mine (somethinghitme.com/projects/stratwalk) thats how I would do it personally.
 
that will allow you to layer the turret blocks over the ground blocks
 
5:17 PM
youll see the map in that code if you look.
I just used tiled to create the data as well (a gui editor)
 
to "put" things in the dom, you mostly use appendChild
 
@Loktar tiled is great (and the devs are pretty cool)
 
Or use a canvas library with a scene graph like pixi.js
 
yeah definitely @ssube
ah yeah caveat to my example I'm using canvas
but still same principles should apply.
 
@Luggage Can confirm, heroku doesn't care if you force push to same remote from new repo. Didn't give a single fuck, deployed the code just fine and kept all config and plugins intact
 
5:20 PM
I'll take a look at tiled. Thanks for the link.
But if I'd continue:
Imagine different buttons for different turrets. How could I fe say that if I click Turret1 and then click a tile on the board a turret of type Turret1 will be created there?
 
@BenjaminGruenbaum your flag request landed in core!
 
so what's the hype about react?
 
it's the next angular: magical over-engineered framework from a large company that will solve all of the web
give it 6 months, a year on the outside, and it will be a paragon of worst-practices
also it mixes code and templates, which is downright evil
 
ssube you so negative :(
 
agreed with @ssube it is just hyped up
 
5:25 PM
Sounds about right
 
@corvid I am usually pretty pessimistic, but some things actually suck.
 
it doesn't look very special or anything, that's why I don't get why there's so much hype
 
You're usually pessimistic, but now you're extra pessimistic?
 
say what you want about it, their virtual DOM implementation is pretty great
and flux is a nice pattern
 
@copy I'm usually presumptively pessimistic, but now I'm realistically pessimistic.
i.e., usually I assume things will be bad, but this actually is bad
 
5:28 PM
I've been told riot.js does a lot of the same stuff as react while being quite a lot smaller but haven't had time to investigate, has anyone looked at it?
 
I'm certainly not sold on JSX, but it's a valid point that separate views and templates is a separation of technologies, not concerns.
 
@ivarni riot and knockout are my favorite MVC framework, although I'm looking into exoskeleton
 
Anyone having this issue?
 
!!> "some-file-name.jsx".replace(/^(.)|-(.)/g, x => x.toUpperCase());
 
@Shmiddty "SyntaxError: expected expression, got '>'"
@Shmiddty "TypeError: x.toUppercase is not a function"
@Shmiddty "SomE-filE-name.jsx"
@Shmiddty "Some-File-Name.jsx"
 
5:38 PM
hey guys
 
hmm..
 
Any canvas fans?
 
@BenFortune nope. Everyone hates it
 
@copy You so sassy :>
 
5:41 PM
I should become a comedian
 
I'm actually impressed on how fast you linked that
 
@copy Promise me that you won't come to India ever :P
 
Take this as a compensation: channel9.msdn.com/posts/…
 
what is a clean way to get values of nodelist options?
 
posted on May 18, 2015 by Alex R. Young

WarriorJS (GitHub: olistic/warriorjs, License: MIT, npm: warriorjs) by Matías Olivera is a game that you play by writing ES6 code. Each level is solved by moving the player and interacting with units which include archers and wizards. The simplest level is best by moving the player left, so you

 
5:52 PM
I want to ignore text nodes
I dont want to use jquery nonsense
I hate it that when you google this all you get is jquery junk
 
@SuperUberDuper legend has arrived, I hail to your presence.
 
hey guys
 
hahah nice!
 
@SuperUberDuper can you explain what you mean by "get values of nodelist options"? What values are you referring to?
 
I just need the options of a select
to compare with control
 
5:56 PM
"nodelist options"? which options? fiddle?
ahh
 
select input
document.getElementById('names').options :)
 
So you basically need to map a NodeList collection?
 
selectElement.getElementsByTagName('option')
^this will do
 
thanks
i like .options more now I found it
 
I was gonna suggest [].map.call(document.querySelectorAll('option'), function(e) { }); but I guess I was overthinking it
 
6:02 PM
I don't get what the point of .call is...
 
!!tell corvid mdn function.prototype.call
 
oh just to transfer a context for "this" into it?
 
and passing arguments
 
Yes, a NodeList looks like an array but it doesn't share the prototype so it lacks functions like forEach and map
 
6:04 PM
!!> Object.getPrototypeOf(NodeList)
 
@AwalGarg "ReferenceError: NodeList is not defined"
 
@CapricaSix stupid bot running in a worker :(
 
can someone help me not be stupid? I'm trying to get lawnchair up and running nad am having a fundamental disagreement with javascript - brian.io/lawnchair
in his demo he declares 'me' inside his callback function
what if I want to add data from outside the lawnchair instance?
I've not seen him call store.save(something) successfully outside the inner scope of the lawnchair
and it must be something I don't understand about javascript
 
@AwalGarg I love how that message didn't get any stars ^^
Also, thanks.
@Zirak hangouts ping
 
you guys have a google hangout up?
 
6:23 PM
also in this line:
store.get('brian', function(me)
is this method specific to the key brian? or for all keys?
 
@ElliotBonneville Nah, we don't do that very often
methinks Benji sent Zirak a message via hangouts chat
 
@SomeKittens oh, okay.
thought I was missing out on all the fun!
 
@ElliotBonneville yeah, that.
What do you need with Batarang @SomeKittens?
 
why is this room tagged cereal and es17?
:o
 
@ElliotBonneville future-proofing, I guess
 
6:30 PM
Little continuation: how can I figure out which HTML object (in this case a div) was clicked on?

So if I'd click on tile12, how can I get that?
 
javascript's future is cereal
 
@BenjaminGruenbaum maybe because it is not clear enough :P just a sec
 
@ElliotBonneville cereal is probably very important to us
@Kryptonous use data- attributes on each element
 
@BenjaminGruenbaum's suggestion at github.com/nodejs/io.js/issues/1674#event-307563651 has been implemented in iojs core. \o/
4
^star that folks :D
 
@AwalGarg lol :D
 
6:32 PM
I made a thing trying to recreate this
Second time ever trying canvas
 
@ssube isn't it better to use the object.addEventListener("click", myScript);?
I'm getting smarter by just sitting here
 
@Kryptonous yes, but bind them all to a single handler
 
you can simply use this in the event handling function to find out which node got clicked
 
in the handler, take the object that fired the event and get the necessary data from it
 
so, if I have an object gamezone which is situated in a forloop (to create tiles), then I'd write: gamezone.addEventListener("click", myScript); ?
 
6:38 PM
@Kryptonous sounds like a case for event delegation
 
If I refer to the same fiddle I created a while ago, how can I add the event listener to every tile? (fiddle: jsfiddle.net/m654rf0s/1 )
I used gamezone.addEventListener("click",myfunction()); but that didn't do it
 
Hello!! Is someone of you familiar with Ackermann's function?
 
what can you assign to disabled?
0 or 1
or true or false
 
Is there a way to make an event listener take priority in queue over other listeners?
@SuperUberDuper try each and test
 
@SuperUberDuper "disabled"
 
6:50 PM
oh right
 
if I use getElementById(), how can I use as ID: "tile" + x + y ? It says the value is null, but how I can add an addEventListener to every object created in a loop with a unique ID?
 
@Kryptonous : jsfiddle.net/m654rf0s/2 <--
doSomething is the event handling function
 
@KarelG you mean disabled='disabled'
 
yeah to use the disabled attribute
 
@KarelG Thanks. I wrote DoSomething() and that issued the function everytime a new tile was created, so not onclick
it was really weird
 
6:59 PM
@SuperUberDuper or just <input disabled/>
 
@Kryptonous updated using data attribute. jsfiddle.net/m654rf0s/3
 
Is that data attribute useful if I use the addEventListener?
 
it's a way to pass data. there are other ways but using that attribute is just the easy way
 
This might be useful for someone: github.com/copy/jslzjb-k
 
Ok. Thanks a bunch!
 
@copy nice. I don't understand any of the code but it looks cool.
 
Great documentation
Awesome test cases
Would recommend
 
lol
@copy so... how do we decompress?
 
@AwalGarg mind-altering substances, video games, and sexual imagery?
 
It's one-way
 
7:10 PM
@Shmiddty tuesday?
 
Compression only
 
@ssube But it's Monday.
 
monday is compression only, yes
 
@AwalGarg Actually that's also in there
 
@copy why is use asm commented out?
 
7:11 PM
@copy Software engineering is a kind of lossy compression. Once you've been through it, there's no way to decompress. :(
@Shmiddty but those normal things normally happen on a normal tuesday
 
@BenjaminGruenbaum Because it's not valid asm.js yet
 
!!s/tues//
 
@Shmiddty @Shmiddty but those normal things normally happen on a normal day (source)
 
@copy that's definitely worth fixing, also simd would be great there but its support is experimental and sporadic
 
@copy lol I didn't scroll down XD
 
7:13 PM
!!tell ssube s/tues/shoes/
 
@Shmiddty Command s/tues/shoes/ does not exist. (note that /tell works on commands, it's not an echo.)
 
d'oh
 
Took me way too long to realize my bootstrap.min.css was 2.1 instead of 3.0 -_-
fuck
 
@BenjaminGruenbaum Yes, but I've only had pain trying to work with asm.js in the past
 
@SterlingArcher You didn't check your package.json?
 
7:15 PM
is there an async JSON.parse for huge piles of JSON data?
 
There isn't one, I was putting my java app into a skin my co-worker made. But my bootstrap 2.1 overrode the 3.0 and I didn't realize it
 
@copy I agree, just thought it would be interesting to try out. It might be nice to provide convenience methods for creating the output array automatically and maybe even feeding a regular array. Not sure it's worth it though
 
@ElliotBonneville I looked into that some time ago and couldn't find anything
 
One ugly way to make it faster is to replace objects with arrays
 
7:16 PM
looks like node people won't take it in because it's supplied by v8 I guess
I'm working mainly with arrays, how does that help?
 
@copy What do you do, professionally?
 
@BenjaminGruenbaum Noted
 
@ElliotBonneville look for streaming json parsers
Although I wouldn't use json probably
 
@BenjaminGruenbaum ah, ok.
 
copy hunts badgers for a living
 
7:19 PM
Need ArrayBuffer.transfer
@Shmiddty Student, mainly
 
I'm reading/writing a file to save multiple arrays of 100-1000k elements. if not JSON, what would you recommend?
and I'm also saving a few other attributes too
 
@ElliotBonneville JS engines can create arrays faster than objects (not generally, just what I observed)
 
@copy ah, interesting.
 
@BenjaminGruenbaum They're much slower than native JSON parsing though
 
@copy no inherent reasons for that.
 
7:22 PM
@ElliotBonneville Make your own binary format
@BenjaminGruenbaum Being written in C doesn't count?
 
of course not
 
@copy What do you plan to work on? Or what would be your preference?
 
maybe xerox machines
 
@copy you can easily outperform native JSON.parse if you know the schema in advance.
Just think about all the assumptions that'd let you make.
 
@Shmiddty I don't know, to be honest
@BenjaminGruenbaum That's interesting, I'll need to look into that
 
7:27 PM
@copy Choice anxiety? I imagine you could actually do anything you wanted.
@corvid It's basically .NET forms, modernized, running client-side.
 
> We did not invent the algorithm. The algorithm consistently finds Jesus. The algorithm killed Jeeves.
The algorithm is banned in China. The algorithm is from Jersey. The algorithm constantly finds Jesus.
This is not the algorithm. This is close.
 
@Shmiddty You mean React?
 
@corvid Yeah
 
@AwalGarg XKCD is best
 
7:30 PM
https://msdn.microsoft.com/en-us/library/aa719775%28v=vs.71%29.aspx
vs
https://facebook.github.io/react/docs/component-specs.html
 
!!youtube React: Rethinking Best Practices
 
^ That's about the best concise-ish description of React's benefits I've heard
 
gist.github.com/argentum47/cfbe55e5c588f8e931d4 how can I improve this such that instead of doing $google.init() inside this.login() I can do something like .run(['$window', '$google', function($window, $google) { $window.googleAsync($google.init) } ) after the provider definition
 
@Shmiddty No, there are plenty of things, but I don't know where I will be in a year
 
7:41 PM
@copy how far along are you in your studies?
 
@Retsam yeah I like that video
 
@ElliotBonneville First semester (out of 4) of my master
 
@Shmiddty I think the react life cycle is more sane then web forms
 
@BenjaminGruenbaum Don't be so afraid of walking on my toes: write a better answer if it may help OP ;)
(I'm unsure of his real goals myself, it seemed ok to me to do what I proposed but I'm a noob at promises)
 
a better link with the web form lifecycle methods.
 
7:43 PM
@copy cool. computer studies, or?
 
@ElliotBonneville IT security
 
preinit/init/initcomplete/preload
 
cool
 
then finally load
 
that's a good field.
 
7:44 PM
oh wait we have prerender after loadcomplete, then render! :P
god I do not miss working with web forms.
 
#reacted
 
@Loktar Sure, but you still have that separation which makes specific things a bit awkward.
 
@dystroy I'm not sure what he even wants
 
!!s/w//
 
@SterlingArcher @dystroy I'm not sure hat he even wants (source)
 
7:50 PM
DAMMIT
 
e.g. You want to get the height of a DOM node for use in the render method. You shouldn't do this in the render method itself because that wouldn't be deterministic. componentDidMount will work for many situations, but is generally before the subtree is fully flowed.
 
anyone here use Stripe before? Having a bit of trouble here
 
helpplz anyone?
 
depends on the constraints of your string, but I'd start with a regex — Stephen Thomas 37 secs ago
 
8:03 PM
the question and that comment hurt my soul
 
Converting from mongoose-q to bluebird is a pain :(
What a stupid constellation. Mongoose provides promises itself, but has no .catch() :P Simply adding bluebird breaks everything, because mongoose expects callback with a signature of function( result, numberOfRecordsAffected ), so you have to .spread() or unwrap manually
So frustrating to unravel all of that :P
 
@OliverSalzburg well, in 3.0 this doesn't happen
 
@BenjaminGruenbaum Yeah, I know, because I read one of your SO answers about that ;D
 
@OliverSalzburg in 3.0 the default is to just take the first argument in these cases. So if you use bluebird 3.0 (currently in beta) you won't have to do all those conversions.
We expect release of stable within a week, the things holding us back are the docs and the landing page.
 
Yeah, I might grab 3.0 and make another attempt at this conversation
 
8:18 PM
yay
 
But I realized that direct access to mongoose models is way too spread out throughout the whole codebase
It might be better to centralize data access somewhere
But I'm determined to get rid of Q now
And I updated to Node 0.12.3 today and I feel like everything got noticably slower
Like, we now have tests failing due to timeouts which worked just fine with 0.10.x
 
@OliverSalzburg there's bluebird-q as a migration step
Yeah, 0.12 is slow, io is faster
like, the hirarchy is io > 0.10 > 0.8 > 0.12 > 0.6 or something wonky like that
 
@BenjaminGruenbaum My issues are mostly with mongoose interaction though. But, thanks
@BenjaminGruenbaum I'll give io a shot tomorrow. I assumed it's only relevant for ES6 stuff (which we don't use right now)
 
Yay
Submitted my presentation news.ycombinator.com/newest
If anyone wants to vote :P
 
@NickDugger was playing agar.io.. was the biggest on the team and map, get into epic battle with green guy. His team boosting, my team boosting me, stalemate. Then my own team member blew a green burst thing right into me, which exploded me into the green opponent and I lost all my matter.
Fucked over by my own teammate :(
 
8:27 PM
When you play the game of blobs, you win or you die.
 
Like @SomeKittens and stuff who helped test it
"Observables and Data Flows in Angular 2.0 "
 
@BenjaminGruenbaum Didn't know you gave that presentation in Hebrew
 
I did
It's gonna die at 2 points but oh well :D
 
I love agar.io. It's so fun, and so simple. A very well made game
I wonder if the maker will turn it into an xbox version :O
Speaking of, if anybody has an Xbox One with Destiny, add me! I need xbox friends
(Or CoD:AW, or any Halo)
 
crap, agar.io is blocked here
 
8:32 PM
Blocked by TLD or..?
 
@BenjaminGruenbaum which one is yours?
 
@ShotgunNinja observables and data flows for Angular 2.0
 
@SterlingArcher By TLD, I think. It's through Barracuda.
 
ahhh that sucks
 
oh irony that an unit test fails because it's poorly implemented. Was digging the source code for any errors ....
 
8:40 PM
is there a way to link directly to jQuery TE to download from that site?
 
TE?
 
@KarelG who tests the tests?
 
@ShotgunNinja :p But if you have a test suite that fails, but cannot find/reproduce it in the source code, then the problem is at that suite ;)
 
@SterlingArcher or a native app
 
ty, ppl normally forget the full path so people can't easily point to them
>:D<
 
np, good luck killing all CMSes @php_purest
 
What's the best way to accrue stackoverflow points? Just watch the front page?
 
@GarrettKadillak watch the tag
 
@AwalGarg I've noticed the trend of plenty of jquery questions
 
8:46 PM
@php_purest That's some terrible English on their homepage
 
like if everyone has English as their native language, Zirak
 
awal @AwalGarg
 
> lightweight (19.5 KB)
lol
php @php_purest
 
what was lol @AwalGarg?
 
19.5kb is not lightweight
 
8:50 PM
19.5 kb is pretty lightweight if you live in the modern world.
 
k
@Loktar lightweight for a text editor?
 
It is not lightweight for a plugin. It depends on jquery too.
 
oh I thought you were talking about JQ itself :P
still 19.5kb only takes 2 seconds on 56k
 
Heck, it even only takes a few seconds over an old dialup modem
 
noob
:P
 
8:52 PM
is there a better TE than jqueryte.com/demos
 
yes
 
like?
 
medium's text editor's open source implementation
 
only thing i need to figure out is how to turn off the script tag
 
tinymce.com I like this one
very programmable, easily customized
 
8:53 PM
> 73.842 kb
^ mediums text editor.
 
for a video site that is extremely light weight
 
yes, atleast it doesn't suck :P
and they don't call it lightweight either :P
 
what doesn't?
 
I haven't met an online text editor that doesn't suck, ever.
 
tinymce looks to be 308kb
 
8:55 PM
@SterlingArcher yeah tinymce and ckeditor are the big ones
they are fine if you are using them out of the box.. but once you need customizations, god help you.
 
ckeditor?
 
just set content-editable="true" and live a happy life :P
 
what would you rather use on a video site?
 
@php_purest whats youtube use?
 
for what? editing videos is not possible in a text editor :/
 
8:56 PM
...
 
for comments, write your own
 
way too much code
 
i mean in a comment box
 
for comments I prefer a nice fat textarea
if I'm developing it that is :p
otherwise it better be super fancy
 
pastebin.com/Bdsv0X3Q basic tinymce usage
 
8:57 PM
and if you have a profile?
 
@php_purest WRITE. YOUR. OWN.
XD
 
@AwalGarg wtf why?
So many exist already
why waste time on writing one?
 
RE. INVENT. THE. WHEEL.
 
@AwalGarg i like the front end cmses, not the back end ones
 
@php_purest TinyMCE, CkEditor, Medium Editor, and the JQ one you posted are all fine solutions.. just look at each one and pick the best one that fits what you want.
 
8:58 PM
@Loktar see all the time he is wasting on selecting one of them? He'd rather put it on making one.
 
if only backbone had one
 
@AwalGarg also thanks for the heads up on mediums, looks cool
 
sure :)
 

« first day (1675 days earlier)      last day (3290 days later) »