« first day (1908 days earlier)      last day (3056 days later) » 

8:00 PM
I could able to read json from angularjs controller, now..
$http.get('result.json').
            then(function(data) {$scope.tabular_data = data;} , function(data) {console.log("My error: " + data);} );
 
const bcryptHashAsync = (password, cost) =>
	new Promise((resolve, reject) =>
                	bcrypt.hash(password, cost, (err, data) => err ? reject(err) : resolve(data)));
 
but data passed in the callback is a wrapper of actual data
 
@overexchange Yeah, and?
 
Is that the expected behaviour?
 
Yes ... each HTTP request has a header and body. The header contains fields like status code, type, ... and body is the content you want
 
8:04 PM
so does it make sense to say, $scope.tabular_data = data[1]; instead of $scope.tabular_data = data; ?
 
@FlorianMargaine I'm still transitioning between the two :D
@overexchange .. no?
Look at the object you've gotten, how would [1] help you?
 
your data is in "data"
access it ?
 
@SterlingArcher So I think I finally got my resume cleaned up, lol. Downside is taking out all the non-development stuff out it's two different positions, and leaves a four year gap, lol.
 
data.data[0] gives your first data item. Or data['data'][0] if you want to be clear. (the var name should be renamed IMO )
 
yes I mean data[1] points to complete data
 
8:07 PM
@overexchange try it and see.
 
dev tweeted me
they are using my react component
pretty cool
 
@Loktar link?
 
@Loktar Adblock kills it though.
 
I cant take full credit
the collaborator did a bunch of work as well
 
Hmm
@Loktar How come this works without .bind()?
 
8:11 PM
Line 8
 
@MadaraUchiha that doesn't look too back actually
 
Missed that one
 
@Trasiva it's ok, let the interview do its thing lol
 
@SterlingArcher bad*?
 
8:12 PM
@SterlingArcher Until they decide that "Oh, must be he was in jail. DENIED!", lol.
 
crl
onWindowScroll = e => { // boom no more .bind needed, but people tend to ignore it... it seems
 
@SterlingArcher Bluebird does things a bit differently (and evilly) to gain performance boosts
That function is "slow" because of the closure.
Bluebird creates a new function using the Function constructor, and lets the JIT optimize it
(Please correct me if I'm wrong @BenjaminGruenbaum ^)
 
ah nm @copy responded
 
But that's the basics of it
Worth noting @SterlingArcher, you should probably try to get your .then() callbacks to be single statements, then you can drop the {} and the return.
Makes things less verbose and more readable.
25 mins ago, by Madara Uchiha
return bcrypt.hashAsync(pass, 11)
	.then(password => db.query(`INSERT bla bla bla`))
	.then(data => db.query(`INSERT MORE bla bla bla`))
	.then(moarData => /* whatever */)
 
I was thinking that, but wouldn't long queries be horrible to read?
 
8:16 PM
@SterlingArcher Multiline strings ftw?
 
Doesn't a multi-line string require {}?
 
@SterlingArcher Nope.
As long as it's in a single statemnt.
 
:O
oh
nice
 
return bcrypt.hashAsync(pass, 11)
	.then(password => db.query(`INSERT
								bla bla bla`))
	.then(data => db.query(`INSERT MORE bla bla bla`))
	.then(moarData => /* whatever */)
That works just as well ^
 
But you said template strings in queries are bad [mmkay]
 
8:17 PM
@SterlingArcher No, injecting variables in queries are bad.
 
Using the multiline feature is fine
Although if you really want, this works as well
return bcrypt.hashAsync(pass, 11)
	.then(password => db.query("INSERT\n" +
                               "bla bla bla"))
	.then(data => db.query(`INSERT MORE bla bla bla`))
	.then(moarData => /* whatever */)
But that sucks :P
I don't know what db is
But most libraries allow you to pass multiple parameters to query()
Something like this
db.query(`SELECT * from table where id = ?`, userId)
And that will prepare and execute the query for you.
Check the specific syntax for the *SQL package you use.
 
Yeah, it's just an abstraction I made
prepared statements will work, I just need to pass a param object into query
 
Right
 
8:21 PM
@SterlingArcher .then(rows => rows) is redundant.
Also, what happened to using disposers?
 
It broke everything
 
Here's how it should look:
 
@MadaraUchiha yes it is data['data']. sorry
 
madara got credit instead of me :/
 
function getConnection() { // Disposer<Connection>
  return db.getConnectionAsync().disposer(conn => conn.release());
}

function query(query) {
  Promise.using(getConnection)
  	.then(conn => conn.queryAsync(query));
}
 
8:25 PM
thank you karel
 
@SterlingArcher roughly like that ^
Here is disposer()'s theoretical implementation
 
are these the real statistics: darw.de/statistik/statistik-js.php
 
Promise.prototype.disposer = function(callback) {
  var promise = this;
  return {
    promise: promise
    disposerCallback: callback
  }
}
 
crl
when you type a super long thing in console and type up key mistakenly..
 
and here's using:
Promise.using = disposer => disposer.promise.finally(disposer.disposerCallback)
@crl That's usually when people in the open space stare at me in shock after the yell.
@SterlingArcher very roughly, because you can't really use a Disposer as a Promise
It's actually a wrapper object.
 
crl
8:29 PM
hehe
 
There, that's a better implementation @SterlingArcher ^
 
I'll read more up on that, I gottta run to another meeting
Thanks for the help
 
Is key not the index of array i.e., 0, 1, 2 here..
                        $scope.rows = data['data'];
                        angular.forEach($scope.rows,function(value, key){
                            $scope.rows.key.marketValue    = parseFloat(value.marketValue);
                            $scope.rows.key.cash           = parseFloat(value.cash);
                        });
json is [{"name": "Brokerage Account 3", "marketValue": "1999990", "cash": "1995826", "legend": "orange"}, {}]
 
@ajaxGuru it doesn't back with sources from where it got the data
 
8:37 PM
@overexchange You should seriously stop asking these questions here.
 
ich spreche eine bisschen deutsch. Aber was ist "Ausnahmesituationen" ?
 
Try it and see. Use console.log, use the debugger, see what value is in what variable, and program accordingly.
 
in other words, what is "Ausnahmesituationen" ? * googles *
 
We don't magically know either, we look it up in the documentation
 
exceptional situations ... hmff
 
8:38 PM
That's what you should do as well.
 
@KarelG on the main it says google
 
crl
@MadaraUchiha why is it 'bad' to modify the arguments of a function? the vaues passed inititally when calling the function are not changed
 
@crl Well, consider this:
 
crl
!!> var x={x:1}, y={y:1}, test=(a,b)=>[a=b,b], [a,b]=test(x,y); JSON.stringify([x, y, a, b])
 
@crl "[object Object],[object Object],[object Object],[object Object]"
@crl "[{\"x\":1},{\"y\":1},{\"y\":1},{\"y\":1}]"
 
8:44 PM
var myObj = getObj();
var anotherObj = getAnotherObj();

var result = makeResult(myObj, anotherObj);

// What's my state here?
 
crl
the new state is in result
 
If you follow the rule of not mutating the objects you pass in, the state will be that myObj and anotherObj as the same as you got them from getObj() and getAnotherObj(), and you have a result value from the makeResult function.
If you don't, then you have the result value from the makeResult function, but you have no idea what's the state of myObj and anotherObj.
You now need to dig in makeResult and understand it, if you want to reuse myObj or anotherObj later down the road.
This is especially counter intuitive because makeResult does return something
 
crl
but I'm not mutating the 'inside' of my arguments, but the arguments themselves, and this doesn't seem to change the originals
 
makeResult( Object.create(myObj), Object.create(anotherObj) )
should fix all of that?
 
@towc God, please no.
 
8:46 PM
or I have no idea what you're talking about..
 
crl
it's just for avoiding another temp variable
 
We aren't Java, I don't want to add 50% extra boilerplate eeverywhere.
@crl Well, you can do that, in fact, before we had default arguments, we did that just
function foo(a, b, c) {
  if (typeof c === 'undefined') {
    c = b;
    b = 5;
  }
  ...
}
Same as
function foo(a, b = 5, c) {
  ....
}
 
@ajaxGuru it's not a valid source if you name only "google". It wouldn't work in papers or scientific reprots
 
And if you re-apply the binding on the argument names, it won't alter the originals
 
i can write "i got the data from PHP.com, google, ... "
 
8:49 PM
But just be advised that messing around with it in your function makes it really unreadable.
 
crl
hmm ok, will avoid it (and later default args too yes), thx
 
anyone in washington DC?
 
@SuperUberDuper blame Obama if nobody responds
 
lol how?
 
8:53 PM
@SuperUberDuper you did? good for you.
 
:27964182
 
whatever
 
@MadaraUchiha you're still doing some lisp stuff?
 
@FlorianMargaine Here and there, when I have the time
 
8:57 PM
cool
 
I need to get myself acquainted with: 1. the ecosystem. 2. the build system and 3. how to do functional stuff like partial application and monads with Lisp
 
crl
(* (- 2 1) (+ 3 4)) // that's (2-1)*(3+4) in lisp right?
 

« first day (1908 days earlier)      last day (3056 days later) »