Archive

function chaining javascript tutorial

Function chaining is somehow getting a popular way to structure your javascript code these days, especially with javascript promises on the rise. Here is a simple tutorial how to do function chaining in javascript.

This is how you can do function chaining using object literal:

var foo = {

  test: function () {
    
    console.log('running test');
    
    return this;
  },

  bar: function () {
    console.log('running bar');
    
    return this;
  }
};


foo.test().bar();

And here is how you can do function chaining using function constructor:

var foo = function () {
  
  this.test = function () {
    
    console.log('running test');
    
    return this;
  };
  
  this.bar = function () {
    
    console.log('running bar');
    
    return this;
  };
};

var f = new foo()

f.test().bar();

bitcoin trading API JavaScript

Bitcoin world loves JavaScript. I was just going through API mtgox.com and node.js is very well supported. This makes it a lot of fun to develop for, and also very fast. There are so many barriers to enter any real financial trading platform, (with some exception, but the new cyber currency makes it almost fun to create things high frequency trading algorythms.

To make a real-time quote steaming is as easy as this:

var MtGox = require('mtgox');
var gox = new MtGox();

// Get maket stats
gox.market('BTCUSD', function(err, market) {
    console.log(market);
});

Here is a link to the node.js npm package.

online fax online failed

So it appears, that 2012 we have not still figured out how to send a Bank Of America officer a 25 page document over the internet.

I am trying to send my scanned tax returns to a Bank Of America officer and being a online savvy guy, even a hacker, after 3 hours I have still not figured it out.

Premise: send 25 pages of scanned PDF file to a Bank Of America loan officer.

1 try: email: fails because scanned pdf is to large.

2 try: uploaded the zipped file to a FTP of my website and send the guy the url: fails, the guy will just not click on it because he is scared it will get him in trouble with security.

3. try: uploaded the zipped file to dropbox and send the guy the url: fails, the guy will just not click on it because he is scared it will get him in trouble with security.

4. try: paid for credit at PamFax, trying to send the files via online fax: getting a message on my first file that the Bank Of America fax number is too slow, so I will be charged double the rate: second file fails because it's too large. Almost out of credit at PamFax and still no files send.

5. try: begging the guy to click on the dorpbox links and just download the dam files: failed: no response

6. try: googeling around how to downsize a pdf file so that I can either email it or fax it... only seeing links to adobe acrobat pro which can do it but costs around $150.

7. try: going to a torrent site, and downloading a adobe acrobat pro with a crack, trying to install it: crack too complicated to implement, don't have time for that, so making regular trial registration for a 30 day trial, fortunately, it comes full featured for that period, so I can resize my files now... sending resized files to gay at BOF, no return messages so far... guy emails me got the files, replying back to him: "Great.... " after I send the reply email, geting a delivery failure, apparently the footer of his email with all the disclaimers does not pass their own security filters... go figure... but he got the files now... I have wasted 4 hours of my life.