Skip to content

Author: admin@master

Javascript – deepEqual Comparison

Question (From Eloquent Javascript 2nd Edition, Chapter 4, Exercise 4): Write a function, deepEqual, that takes two values and returns true only if they are the same value or are objects with the same properties whose values are also equal when compared with a recursive call to deepEqual. Test Cases: My code:…

Angular JS Handle controller Events

I have an application having a lot of things to save in cascade, imaging a normal master – detail view. In this view I have a “Save All” Button that save each row in an iteration, triggering jQuery custom events, to serialize the saving operations and prevent the generation an uncontrolled q…

.blur() sound notifications

I have two text boxes whose values are ‘yes’ and ‘no’. When I type ‘yes’ in the first text box, it beeps and the same should happen with the remaining text box. The sound should play only once when I enter the correct value in the corresponding text boxes. In my case, the s…

How to make animation() endless

I have an element which should be animated all the time. The animated element has such CSS properties: I can only move the element to a particular way, like this: But this will just animated for 2000px my element has an endless width. UPDATE: ALL 7.5 Sec. #world become bigger. FIDDLE Answer You can have a rec…

Javascript prototype from instance

I would like to make objects, with earlier created objects as the prototypes. This way I would be able to make additions to existing objects without modifying them. Methods which interact with the earlier created objects (so using there attributes and perhaps mutating them) could also be applied to the newly …

Rest with Express.js nested router

Suppose I want to have REST endpoints which look roughly like this: CRUD on each if makes sense. For example, /user POST creates a new user, GET fetches all users. /user/user_id GET fetches just that one user. Items are user specific so I put them under user_id, which is a particular user. Now to make Express…

How to read and save attachments using node-imap

I’m using node-imap and I can’t find a straightforward code example of how to save attachments from emails fetched using node-imap to disk using fs. I’ve read the documentation a couple of times. It appears to me I should do another fetch with a reference to the specific part of a message be…