« first day (1365 days earlier)      last day (3587 days later) » 
00:00 - 16:0016:00 - 00:00

12:24 AM
0
Q: Dont understand javascript promise antipattern, reeturning promise from callback

spirytusCould someone explain to me why returning promises in promises callbacks is considered antipattern? Apparently it breaks exception bubbling but obviously my understanding of promises is lacking as I cannot clearly picture how would that work. My antipattern code is below: var a = new Promise(fun...

 
Oh, that reminds me, @BenjaminGruenbaum: I don't get deferred, and all the explanations I found suck.
// why use this...
var defer = somePromiseCrap.deferred();
async(function (e) {
    if (e) { defer.reject(); }
    else   { defer.resolve(); }
});
return defer.promise;
// ...over this...
return Promise(function (resolve, reject) {
    async(function (e) {
        if (e) { reject(); }
        else   { resolve(); }
    });
});
That's the situation where I saw people saying "use deferred".
 
12:42 AM
Because you can use defer.resolve anywhere
 
You can also call resolve anywhere
You're returning defer.promise, not the deferred object itself.
 
Well, yeah. But deferred is what you could use for resolving
 
@copy So why use the deferred over just resolve or reject?
 
I don't really know
 
1:05 AM
what is wrong with this json data
{
"id": 1,
"firstName": "Peter",
"lastName": "Jhons"
},
{
"id": 2,
"firstName": "David",
"lastName": "Bowie"
}
jsonlint says it is wrong.
 
you have two objects
should be enclosed in an array
 
Is that a requirement for json to be valid>
 
yes
or one object
 
hmm, I am surprised knowing that.
 
1:32 AM
@Zirak when will you be here?
We want to get drunk with you.
And watch the NGE movie.
@Zhegan you too.
@phenomnomnominal you're the best.
@Shmiddty you AARE DRUNK
 
@SomeKittensUx2666 you Are kittens
 
no one cares I'm actually a Lemon
 
1:58 AM
anyone know grunt well?
 
@Loktar ^
 
wtf
 
:P
 
I just got home lol
 
my camera's are paying off :)
 
1:59 AM
lol
I'm more familiar with gulp now but I might be able to help @tejas-manohar
 
alright, lemme pull it up
how does this know what to change the link href and script src
after concat
dont i need to set it to something
to avoidf like 300 404s
in build process
of scripts
 
probably uses usemin or something similiar
let me look
oh wait this is concat
it doesn't
you need to use something else such as usemin
so like on your dev html youd have your unminned js files
and they would have comments above and below like this
<!-- build:js js/app.js -->
<script src="js/app.js"></script>
<script src="js/controllers/thing-controller.js"></script>
<script src="js/models/thing-model.js"></script>
<script src="js/views/thing-view.js"></script>
<!-- endbuild -->
 
oh nice
 
then you have your build/dist html file
which usemin makes script.min.js or whatever you want it to be
 
do i need to install uglify concat and cssmin
for that
or does it do it all
 
2:03 AM
I dont think it uglifies, but it concats
 
snap, thats nice
 
admittingly I've only used it with gulp
but I imagine its almost exactly the same with grunt
but yeah its really cool
 
whats the adv with gulp over grunt
 
it does css files like that too
 
(im not familair with either so switching is gg ez)
 
2:04 AM
personal preference at this point really, grunt feels like creating config files
gulp feels like writing js
 
do you need really good js knowledge for gulp?
 
gulp has an edge in speed right now, but the next vs of grunt will nullify that
eh, I mean it would help, I think the barrier of entry is definitely lower for grunt
 
which do you think has a future
more support?
 
really tough to say right now they are both pretty new
bootstrap still uses grunt
and a lot of projects do, but gulp is gaining ground so idk
 
npmjs.org/package/gulp-grunt -- you ever seen this?
 
2:06 AM
I think choosing either one its hard to really go wrong
haha no thats interesting
 
it looks solid
tell me if you know good gulp to help me with this
 
var gulp = require('gulp'),
	usemin = require('gulp-usemin'),
	less = require('gulp-less'),
	concat = require('gulp-concat'),
	livereload = require('gulp-livereload');

gulp.task('less', function () {
  gulp.src('./dev/less/consumer-database.less')
    .pipe(less())
    .pipe(concat('styles.css'))
    .pipe(gulp.dest('./dev/css/'));
});

gulp.task('usemin', ['less'], function(){
	gulp.src('./dev/index.html')
		.pipe(usemin({

		}))
		.pipe(gulp.dest('./build/'))
		.pipe(livereload());
});

gulp.task('watch', function() {
^ current gulp file im using for work
uses usemin
 
i use sass
livereload nice
 
and the tag for my css for example in the html file
 <!-- build:css css/style.css -->
        <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
        <link href="css/styles.css" rel="stylesheet">
        <!-- endbuild -->
which turns into this
 
do you have watch
 
2:08 AM
  <link rel="stylesheet" href="css/style.css"/>
 
on gulp
like where it compiles on the fly?
 
yup
 
awesomesauce
what dso you mean by bootstrap uses grunt?
oh
nevermind i get it
 
i can use both right
 
2:09 AM
yea
 
and just use grunt for very few things that i cant do in gulp
gulp looks prettier
 
yeah its not bad Ive been using it since around feb
so not incredibly long or anything, but again its pretty new
 
yeah
so when installing module globally i use sudo right
i remember i had to with grunt :(
 
you're not supposed to I guess
not use sudo that is
 
globally?
snap
ive been forever
do i need to reinstall stuff?
 
2:11 AM
@tejas-manohar if it works for you no, as a side note I do most of my dev on windows
so I don't have to deal with that much :P
 
o lol
dude at least ubuntu man
 
haha well work is a windows shop
 
lol :(
 
I have ubuntu at home that I do some dev on, all the tools I use are cross platform which is nice
 
nice
so i install gulp in project dir and globally
right?
 
2:13 AM
yeah just globally should work
 
ah
how do i uninstall an npm module
or package
 
er I do it local too I guess
umm npm remove packagename I think
cant remember off the top of my head
 
npm uninstall <name> [--save|--save-dev|--save-optional]
i used npm install grunt --save-dev in my directory
 
ah yeah thats fine too
 
how do i rmeove it just from that directory
npm uninstall grunt --save-dev ?
 
2:15 AM
I imagine so
haha wont mess anything up regardless, or shouldnt if you try
 
true :)
how much longer you think youll be in here?
 
9-10, mon-sun
 
I idle in here always so just ping me and I should be around
lol @rlemon
actually.. thats pretty damn close
 
thanks man, im going to ty to get things together with gulp
 
yeah np
 
2:18 AM
and ill ping you if i need help :)
you good with angular?
 
nah I suck with it
 
its hard
and when you dont write yoru own directives
it sucks
 
haha yeah I had a job using it then switched jobs and we don't use it at the new job.. so Im way out of touch now
 
ah
so can i just go "var coffee = require('gulp-coffee');"
or do i have to download something
i doave to download something i bet
 
you need the package for it
 
2:22 AM
but where do i put it
 
so npm install gulp-coffee --save-dev
then you can use it in the gulpfile
 
where do i put it
just clone it down?
 
itll install it to npm modules
just use npm for all the plugins
 
oh so thats an npm package?
 
yup
makes it a bit easier
 
2:24 AM
i cant find gulp-coffee
only coffee-gulp
nevermind
 
lol
 
silly
gulp.task('default', ['watch', 'scripts', 'images']);
thats what the doc says as deafult
gulp.task('default', function() {
// place code for your default task here
});
thats what it comes as
which is preferrable
*gulp doc example btw
 
oh sorry didnt understand
 
o i get it :)
does minifying images change res or dimensions etc
 
nah just modifies the files I guess
 
2:30 AM
ah
 
like removes unneeded shit from png's ect
reduces the file size
 
what does it really mean by sourcemap
gulp sourcemap
 
oh so when you minify your files and you need to debug on production you can use chrome or firefox and view the minified source like it was unminified
set breakpoints, ect.
 
snap thats nice
 
yeah source maps kick ass
 
2:32 AM
i dont really understand del
 
del?
 
and if gulp is necessary for my workflow should i just go ahead and add these modules to my dependency
in package.json
 
yeah, i just use --save-dev
 
oh thats what it does?
?
if i install anything with that?
 
yup
 
2:36 AM
WTF LOL
so now i have to manually add them
like ive been doing forever
lol
 
haha
 
any quick way to do it?
 
to add dependancies?
if I forget I just do install again with --save-dev
since if they are already installed it doesnt matter
 
wait will that work
install twice?
 
yea
 
2:37 AM
any downsides?
 
yeah itll just see the files and wont do anything
 
i used to look online for the versions
so stupid
 
haha stuff just got a lot easier for you :P
 
definitely
lol sorry about all these stup[id things, still in high school lol
highly inexperieced
devDependencies vs. dependencies?
 
ah np about the questions I dont mind
 
2:41 AM
o
i got it
is there a way to add them to actual dependencies
in installation
 
not sure what you mean
like vs dev deps?
 
not sure how to do it automatically
 
kk but thanks so much
can i write "latest" next to a package in package.json?
like in bower
 
--save? maybe to put it in deps vs devdeps
umm I think haha not 100% on that either
 
2:44 AM
ha its fine
youre right
genius
--save
 
ah nice
 
will npm install in the directory install the devdep as well
 
yeah it should itll read the package file and install what it needs
 
do you havew to install watch
 
I think thats default with gulp
 
2:46 AM
ah
 
3:01 AM
yo @loktar still here
@Loktar **corrected casing
 
yo
 
so i still need coffee installed to use gulp coffee right
 
not sure I dont do anything with coffee
 
how about like sass or less
 
just need gulp-less for less
 
3:12 AM
can you help me configure gulp-sass
i required it at the top
trying to work off docs example
@loktar
 
 
3 hours later…
6:09 AM
@Zirak you should almost never use deferreds but promises directly
 
 
1 hour later…
7:22 AM
I'm trying to match all letters in a string with a Regex. Simple, right? Thought so... but it isn't. Why does this only return one match? /[a-z]/gi.exec('(a)b(c)')
 
exec returns each match in turn, then a null then starts again
!!>'(a)b(c)'.match(/[a-z]/gi)
 
@JanDvorak ["a","b","c"]
 
Ohhhhhh... MATCH! Thanks!
 
match, on the other hand, returns all matches and discards capturing groups
 
That's what I have been trying to find for the last half-hour.
 
7:43 AM
@JanDvorak Strange that the regex that looks like a pair of breasts is also composed of increasing bra sizes
 
8:17 AM
Hello!
 
@UnknownUser 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.
 
Anybody online?
I'm new to Angular JS. I just went through course from PluralSight and in that course there was module was Testing. The testing module was at the last of the course, before he started to test the controllers and other stuffs. He actually built a web app which was running perfectly with no errors. When the application is running without any error. What is the use of running tests?
Can anybody say me why do we need to run tests when our app is working just fine.
Is it compulsory that we need to run test for all our apps?
 
@UnknownUser it's working today, but are you sure it will be working tomorrow?
are you sure you won't introduce any bug in the code when you modify some or some other part of your code?
that's what tests are for; they ensure that your code still works, even if you change some unrelated part of the code
 
9:16 AM
Most inspiring comment I've seen:
You're right I"m stupid — TIMEX Apr 2 '10 at 19:59
 
9:34 AM
@BenjaminGruenbaum "Almost never", Why "almost"? When do you use it?
@BadgerGirl I'm always there with you, in spirit.
 
@Zirak when converting a callback based API to promises?
 
9 hours ago, by Zirak
// why use this...
var defer = somePromiseCrap.deferred();
async(function (e) {
    if (e) { defer.reject(); }
    else   { defer.resolve(); }
});
return defer.promise;
// ...over this...
return Promise(function (resolve, reject) {
    async(function (e) {
        if (e) { reject(); }
        else   { resolve(); }
    });
});
 
9:49 AM
hello
 
@KendallFrey, @JanDvorak You're gonna like this: nbviewer.ipython.org/url/norvig.com/ipython/…
2
 
anyone one tell me how can i change shape of bar chart into triangle shape in dojo
 
10:10 AM
'Ello all :D
I have an issue in my code (I believe in my Syntax) that borks my code. Any ideas?
 
@Iplodman line 25: document.write(slogan)
 
@pqnet 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.
 
@pqnet Cheers, but what's causing it/What's the fix?
 
you wrote "slogan" but you probably meant "product" right?
 
Drools at own stupidity
Thanks so much xD
@pqnet Yeah, I changed that variable at one point, I musta' forgot to change it :l
 
Tomorrow is my second anniversary... thank you google now for saving my butt !
 
Got to go now, cya all :P
And gratz @AbhishekHingnikar! :D
 
facepalm!!!
 
10:58 AM
@Loktar ^ My point from yesterday
 
11:21 AM
damn hippies
 
image
An element to draw into the context; the specification permits any image element (that is, <img>, <canvas>, and <video>). Some browsers let you use any arbitrary element; Firefox doesn’t.
@Loktar omfg
OMFG OMFG OMFG !
our wishes has been granted
 
any of those platforms like jsfiddle or plunker that I can use to develop a whole app without feeling too hindered?
 
@FlorianMargaine - So... the test files which we will be creating is a part of the project that stays alive as long the project is alive. So when ever we do a change to the respective file a log a created with Failure or Success status right? But though we have a built in console in the browser which outputs the same error when something things right?
 
@AbhishekHingnikar - Huh, did I miss something, hasn't drawImage been around since canvas was introduced ?
 
@adeneo you can draw with every element.
 
11:35 AM
@UnknownUser The point of unit testing is to be informed when your change makes something fall over, without having to test the entire code base. Imagine making a change in a deeply nested method on which a lot relies, and then having to test all your controllers/views/code to see if something somewhere falls over.. that's a huge hassle. Unit tests make that easy (but also takes more time to write tests).
 
@AbhishekHingnikar Yeah, hasn't that been there for quite a while?
At least for image and canvas elements
I hadn't ever tried video
 
@AbhishekHingnikar - in Chrome you can, but so what, that's been around for a while, I seem to remember struggling with drawImage years ago as it uses the same origin policy and has issues with images, videos etc. from other domains ?
Well, doesn't matter, it clearly made you happy, so if it solves something you're working on, good for you !
 
user2862309
!!urban purdy
 
@Mr.Meshuggah purdy pretty / cute
@Mr.Meshuggah 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.
 
11:53 AM
Okay... I got it. And so, is it necessary to write tests for smaller apps?
 
@UnknownUser It's not necessary to write tests for any app. It helps, it's useful, and it can be good for you and your team -- but it is not necessary.
 
Oh... Okay. Thank you very much for helping me out.
 
hello people
 
@mysqlphp 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.
 
12:09 PM
OK
 
12:39 PM
@Loktar You'll enjoy this gamasutra.com/view/news/220661/…
(And Nuclear Throne is another good example of a good early access game)
 
anyone dealt with oauth and maybe HMAC-SHA1?
 
1:00 PM
@Mosho oauth 1.0 ?
don't write code for it. there are libs
and if u are doing oauth 1.1 / 1.0 client side ... good luck ...
 
yeah, found it
 
if you wanna learn it though read the spec its horrible i wrote one in python horrible as code
 
it's not too bad
just gotta follow steps carefully
 
1:16 PM
@rlemon @Loktar What happened about this? github.com/JSChatroomGameJam
Let's host a proper one some time!
 
I still don't understand how to use CORS
 
It's a pretty good resource
 
but I have this external API
out of my control
why is it complaining
I'm sure they allow it
 
1:36 PM
@SomeGuy u got an android + chrome ?
4bf75e51.ngrok.com try taking snaps / pinch zoom [ front cam wont work probably yet ]
 
1:55 PM
@AbhishekHingnikar Yeah. I'll try it out after a while!
 
@Mosho check for the header.
 
@AbhishekHingnikar That loads so slow
Why don't you just use Heroku or something?
Instead of using your own computer as a bad host?
 
cache-control: "private"
content-length: "6714"
content-type: "application/json; charset=utf-8"
date: "Sat, 12 Jul 2014 13:56:31 GMT"
server: "Microsoft-IIS/7.5"
x-aspnet-version: "4.0.30319"
x-powered-by: "ASP.NET"
I guess they don't allow it :X
 
How were you sure?!
32 mins ago, by Mosho
I'm sure they allow it
 
Hi guys
 
2:00 PM
@SomeGuy I was under the impression it's common
for that type of API
guess I was wrong
 
Need some help with em in CSS. My application is not behaving right. jsfiddle.net/rdesai/csTS7/95 Reproducing the problem: If you add an item and click on it to edit, enter some text and click somewhere else to save, that text's font size is more than before. If you edit it again, the font-size goes up and up! What am I doing wrong here?
I am not used to using em. But I have heard good things about it. So here I am using it.
But, I am not sure if it is the right way?
 
use REM
not EM
EM is based on the elements direct parents value.
 
Whats REM? o_O
 
google it
rem + css
 
@Zirak Meh, old :P
 
2:18 PM
@rlemon You sir, are awesome.
 
@SomeGuy pita to push
every single update
 
2:44 PM
0
Q: Bluebird catch err logging syntax?

StackThisWhat is the equivalent Bluebird promise err logging to this: if (err) { console.log(err); res.send(err); } For this: }).catch(Promise.OperationalError, function(e){ // handle error in Mongoose save findOne etc, res.send(...) }).catch(function(e){ // handle othe...

 
Guys, need some more help with CSS. I have the Undo/Redo buttons as float: right; and I need to vertical-align it to the middle of the container. But vertical-align: middle; aint working. jsfiddle.net/rdesai/csTS7/100
line-height fixed the issue
:)
 
3:05 PM
Hi guys, could anyone help with this popup?
http://jsfiddle.net/juancristov/8Buk8/2/
I can't make it work full screen
 
Is there a way I can give an image source to <button>? I did <button><img/><button> but it doesnt look good.
 
@RahulDesai You want a background image?
 
@Zirak yeah, but it looks weird on <button>, I am now tying <input type="image">, but I really dint wanted to use <input> because its not a form. Any suggestions?
 
What are you trying to do? A clickable image?
 
3:14 PM
How do people get over double-digit fiddle ids...
If you want a clickable image, just use an image
Or you can play around with background-size and the like
 
Did you know? The collective noun for a group of programmers is a merge-conflict.
 
@Neal/@Neil Remember our argument some time ago about curing sleep? assets.amuniversal.com/7763d7a0e0680131732c005056a9545d
 
3:51 PM
posted on July 12, 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) {} GaymerX rolls on!

 
user1596138
So a Mac Mini won't even boot to another drive if the primary drive fails
 
user1596138
For some reason
 
00:00 - 16:0016:00 - 00:00

« first day (1365 days earlier)      last day (3587 days later) »