« first day (1907 days earlier)      last day (3048 days later) » 

6:04 PM
http://www.commitstrip.com/en/2016/01/05/the-childhood-of-a-coder-a-certain-sense-of-satisfaction/
CommitStrip
The Childhood of a Coder – a certain sense of satisfaction
CommitStrip
1452016876
 
@Loktar IRK!
 
What's the vanilla for this var empID = $('select option:selected').attr('data-emp');, specifically, how do you querySelector the selected option with a select?
 
user1596138
God I hate conf calls
 
@Jhawins did you find the original pic?
 
user1596138
No I was on the phone
 
11
Q: Getting selected options with querySelectorAll

GOTO 0I wonder if it's possible in Javascript to get the currently selected options in a <select multiple> field using the Selctors API rather than a "stupid" iteration over all options. select.querySelectorAll('option[selected="selected"]') only returns the options that were marked as preselected in ...

 
check the pseudo-classes and such
 
@SterlingArcher You the man now dog.
 
document.querySelectorAll('select option').filter(opt => opt.selected).dataset.emp
oh wait... NodeList doesn't have filter
 
user1596138
@ndugger Da fuck
 
6:11 PM
well, whatever
 
user1596138
Even if it did that's broken
 
@ndugger Thanks!
 
you're broken
 
user1596138
That'll give you the one hardcoded to be selected lol
 
@ndugger wrap in Array.from?
 
6:12 PM
@Jhawins no it won't
but it is borken in that it tries to get the dataset of an array
 
user1596138
@ndugger Yeah it's :checked isn't it?
 
option elements don't get checked
 
user1596138
Oh lol
 
user1596138
I thought we were doing multiple checkboxes
 
Array.from(document.querySelectorAll('select option')).filter(option => option.selected)[0].dataset.emp
there has to be an easier way... I don't deal with select elements often, though
 
6:14 PM
[...document.querySelectorAll('select option')].filter( ... )
 
Dat spread
 
If only I worked at a company where all these wonderful minds were on the same team.
We'd be cooking with gas then.
 
@SterlingArcher your mom's legs
 
Ah, here we are. Select elements have a "selectedOptions" property that contains an HTMLCollection
so
 
@rlemon i don't think that this works in Chrome
 
user1596138
6:17 PM
@ndugger options do get :checked.
 
document.querySelector('select').selectedOptions[0]
 
user1596138
so
 
user1596138
document.querySelector('select option:checked'); done
 
@ndugger better yet, iterate it every time (even if you assume 1)
 
@Jhawins Huh, I didn't think they did
 
6:18 PM
@rlemon Any difference between this and Array.from?
 
user1596138
They do.
 
(function() {
  'use strict';
  let arr = [1,2,3];

  function foo(a,b,c) {
    console.log(a, b, c);
   }

  foo(...arr);
}());
works in chrome @KarelG
@BenFortune see ^
 
Fancy
 
spread operator is best operator
 
6:20 PM
Pizza Hut's wing sauces are the most mediocre liquid-shits I've ever tasted
 
@rlemon your mom acts like every operator is the spread operator
 
@SterlingArcher Oh man that's nothing. I once lost my phone and rang my operator to cancel it, ...from the phone I'd apparently lost.
 
@ssube that's because she is easy
 
@ndugger get naked wings with a side of the sweet habanero sauce. They stay crispy and then get spicy.
 
I tried the sweet chili sauce today
It's mediocre
 
6:21 PM
I always get dry dusted wings and add my own hot sauce
 
you gotta get dry wings, regardless of what you put on them
 
she's probably checking if the tank is full ... >_>
 
read the page title
noob :D \
> dumb broad used the lighter to check if the tank was full
 
Tries to blow fire into the tank too, what a fucking idiot
 
worst thing you can do is take the nossle out of your car
just take your hand off it and walk away
most people freak out and yank it out tho :/
 
6:28 PM
@KarelG I think she was trying to light a cig
 
isn't there an off button on the pump usually?
 
yes
 
or some emergency button nearby
I guess it's Russia, though
 
but pumps (here) are a deadman trigger
you can't lock them on anymore
 
We're back baby!
 
6:29 PM
@rlemon oh, that's annoying
you have to hold the handle for 5 minutes?
 
yup
it is safer
I understand why they made the change \
 
Who stole my hats?!
 
sucks on days like today when it is -20c out
 
it is safer
but I like to lean against my car and phone
 
do you open the door a bunch and grab shit from the back seat as well?
 
6:30 PM
plus 15 gallons takes forever
 
making sure of course to jump out of the car without grounding yourself first
 
nah, I stay right next to the thing and keep an eye on it
 
app.use("/css",express.static(__dirname+"/css"));
app.use("/js",express.static(__dirname+"/js"));

app.get('/', (req, res) => {
	fs.readFile('./html/index.html', "utf8", (err, html) => res.send(html));
});

var server = app.listen(8080, () => {
	var host = server.address().address;
	var port = server.address().port;
	console.log('SourceUndead has risen from the dead on port %s', port);
});
 
just not a hand
 
ES6 node <3
 
6:30 PM
@SterlingArcher grab bunyan or something to do your logging
 
@SterlingArcher var? fuckign casual
all of those could be consts
 
const unless you have to let
 
also, template strings noob
 
!!^
 
that console.log is wasteful
 
Template strings?
 
dude
 
I am a noob what are y'all talking about
 
not template strings, a real logger
 
6:31 PM
How do you not know template strings!!?!??!??
 
Wait the backticks?
 
`you can ${foo} shit like this now`
 
string vars are great with a real logger that will skip formatting if the message wouldn't get written
 
`wat`
 
!!>var hello="hello";${hello};
 
@Cereal "hello"
 
const logger = bunyan.createLogger({name: 'eveningdriver'});

// Load config
const rootPath = process.env['EVD_ROOT'] || __dirname;
logger.info('Using %s as the root directory.', rootPath);
It only does the replace if the logger is turned on, has the right level, etc.
Use a real logger.
 
Winston/10
 
@ssube +1, that's the way to go
 
6:33 PM
tried Winston, barely worked. Switched to Bunyan
 
Ech, I didn't like how complex winston was for what I needed in Blackbeard
 
@Luggage any feedback/questions about the codebase?
 
greetings everyone
 
@mutantkeyboard Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
console.log `'SourceUndead has risen from the dead on port ${port}'`;
This doesn't look right
 
6:34 PM
it's not
 
get rid of your single quotes
 
that would log an array
 
use parens
 
it's missing, like, parentheses
 
6:34 PM
nub
 
console.log`SourceUndead is running on port ${port}`
 
You don't need parens with template strings, strangely
 
[ '\'SourceUndead has risen from the dead on port ', '\'' ] 8080
 
I think it's a weird feature
 
6:35 PM
it gives you timestamps and log levels for free
 
I'm getting that output
 
plus if you log objects, it writes the JSON
 
@ssube will check it out, just trying to get started properly
 
@SterlingArcher with logging, that means don't do it yourself
 
Why not?
 
6:36 PM
it's a dirty ol rabbit hole
you use console.log, then you write a class, then you add levels, then timestamps, then filtering, then class-based filtering, then children, the object logging, then interpolation, then ...
 
app.use('/css', express.static(path.join(__dirname, '/css')));
app.use('/js', express.static(path.join(__dirname, '/js')));

const server = app.listen(port, () => {
	app.get('/', (req, res) => {
		let {port, address} = server.address();
		console.log(`server listening on port: ${port}`);
	});
});
@SterlingArcher ^ use destructuring, template strings, path module, and const/let
 
@ssube I don't like that :( JSON adds backslashes which makes reading strings hard :(
 
.
 
spidermonkey has a superawesome function uneval which is way better for this purpose
 
6:37 PM
@ssube syslog4life
 
I log legit, son
 
@ssube now make it log this: {foo: "bar 'baz' is stu'p'id"}
 
I just use syslog() api
you have timestamps and locality and priorities etc
by default
 
I usually just have my unit/service run node, so it picks up stdout to syslog automatically
 
@rlemon why is the app.get inside the listen function?
 
6:39 PM
otherwise, statsd and bunyan to syslog
 
@SterlingArcher ha, because I did a bad job reading your code
but you see the new stuff I used right
still applies
 
I just use console.log/info/error/dir
 
0
Q: Using promises with RxJS Observables

Nathan JonesI'm using RxJS 5.0.0-alpha.12 to perform some data transformations, and some of those transformations use Promises. return observable .flatMap(item => { return Observable.zip( Observable.fromPromise(fs.readFile('./config.json')), Observable.of(item), (s1, s2) => { return {...

 
@rlemon me gusta :)
 
6:41 PM
the biggest thing I think you'll enjoy using is destructuring
 
So, next step is I want a nice clean way to route my pages, which includes serving html
 
@rlemon Express has a better one
 
@BenFortune iirc express uses router
 
express has routing nicely, but serving html is trickier
 
6:45 PM
anyone used koajs here? it feels nicer to write than express style middlewares
 
@SterlingArcher ejs
 
function html(filename) {
	return fs.readFile('./html/'+filename+'.html', "utf8", (err, html) => html);
}

app.get('/', (req, res) => {
	html("index");
});
 
@SterlingArcher Why is it? Just set html as the engine and use res.render
 
Basically I want to pass an HTML filename to a function, where it will a) check if it exists if if so, return it so the route can send it back
 
app.set('view engine', 'ejs')
.use(express.static(__dirname + '/public'))
.get('/', (req, res) => {
    res.render('index.ejs');
})
put all /css and /js crap in /public (/public/css and public/js)
 
6:47 PM
app.set('view engine', 'html');
app.engine('html',require('ejs').renderFile);
 
also for routing I like using express/router
app.use('/', guests);
app.use('/users', users);
app.use('/admins', admins);
 
@rlemon So much this. Even works with nested routing
 
crl
ew ejs.. meh
 
I love express routing. I used it in the original Source
 
@crl why?
or are you just blindly hating
 
6:49 PM
What would go in index.ejs though?
 
@SterlingArcher html
 
<% include header %>
html stuff
<% include footer %>
you can also use js to template your page
 
If you use my method you can keep the html extension
 
crl
80%-blindy, nvm
 
6:50 PM
<p> Welcome, <%= username %> </p>
 
extensions aren't even a real thing
 
@ssube How Can Extensions Be Real If Our Eyes Aren't Real?
 
What method is better innerhtml or createElement ?
 
@BenFortune eyes are real. Ever poked on? They squish.
 
@SterlingArcher stuff like this:
<ul>
<% for( var i = 0; i < items.length; i++) { %>
<li><%= items[i] %></li>
<% } %>
</ul>
is why I like using ejs
it is already a syntax I understand
 
6:52 PM
haml and ruby would do that like
 
Handlebars/Mustache seems a bit nicer than EJS, imo.
 
haml and ruby are bad
and slow
 
I just don't like that I have to learn an entire new syntax for haml
 
and unstable
 
also why I don't like jade
 
6:53 PM
I love hbs, but ejs is just as nice
 
%ul
  -items.each do |item|
    %li=item[i]
 
I prefer handlebars and breaking things down so each file is short
compose them at the view/component level
 
Trying to install EJS but npm install ejs won't let me
 
Getting sick of your shit chrome
 
@SterlingArcher it installed
 
6:55 PM
Oh
 
WARN !== FAIL
npm list ejs
 
warn is bad but not fatal
add a readme
 
lol
I perpetually have those warnings
 
Error: Failed to lookup view "index.ejs" in views directory
>=(
 
do you have a /views directory ??
 
6:56 PM
No, I put it in public. Where is it getting views from? Default?
 
app.js
/views
  index.ejs
/public
  /css
  /js
structure like this
 
make your express static directory /public
you don't need to specify js and css alone
 
you should give rlemon a can of beer once you get your server working
 
you can change where it looks for the views, but by default it looks in /views relative to app.js
 
6:58 PM
@pootis risr
 
I like this
 
woot
 
@rlemon I like to get rid of warnings (like, I take it way too far and get rid of every single one) so that if I see anything colorful, I can just be like "OH SHIT ERROR"
 
You should use blackbeard
 
so @SterlingArcher remember the domain discussion we had yesterday
 
6:58 PM
Is it comparable to angular's way of passing data from view to controller?
 
blackbeard > express, because I'm cool
 
and I was like, oh yeah I own over 100 domains a lot of zombie themed ones
 
@Loktar the pricing and stuff?
@ndugger lol
 
yesterday someone offered me $200 for one out of the blue
and I countered with $600
 
No way haha
 
6:59 PM
they accepted, and it just went through escrow
 
Did he bite?!
Wowwww
 
haha was super random but funny since we just talked about it
 
for those intrested
i wrote a peer to peer self discovery and communication lib for phonegap
 
as soon as its 100% complete Ill drop the name, its nothing insane
 
uses tons of other libraries (zeroconf, chrome-tcp)
 

« first day (1907 days earlier)      last day (3048 days later) »