Change DNS on Ubuntu

In /etc/NetworkManager/NetworkManager.conf comment out the line dns=dnsmasq

sudo nano /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
#dns=dnsmasq

and restart the NetworkManager service.

sudo restart network-manager

sudo rm -f /etc/resolv.conf # Delete the symbolic link
sudo nano /etc/resolv.conf # Create static file

# Content of static resolv.conf
nameserver 208.67.220.220
nameserver 208.67.220.222

References
http://askubuntu.com/questions/690511/how-to-change-dns-in-ubuntu-15-10

CSS media Query

if screen width is less than 768px use this custom style:

#loginBody {
  width: 600px;
  height: 400px;
  margin-top: 100px;
  border-radius: 25px;
  background: rgb(238, 238, 238);
  background: -moz-linear-gradient(left, rgba(238, 238, 238, 1) 0%, #f8f8f8 100%);
  background: -webkit-linear-gradient(left, rgba(238, 238, 238, 1) 0%, #f8f8f8 100%);
  background: linear-gradient(to right, rgba(238, 238, 238, 1) 0%, #f8f8f8 100%);

  @media screen and (max-width: 768px) {
    width: 300px;
    height: 300px;
  }
}

http://www.w3schools.com/cssref/css3_pr_mediaquery.asp
http://www.w3schools.com/css/css_rwd_mediaqueries.asp
http://www.w3schools.com/css/css3_mediaqueries_ex.asp
http://www.w3schools.com/bootstrap/bootstrap_grid_system.asp

how to get the last N records in MongoDB

.sort()

db.foo.find().sort({x:1});

The 1 will sort ascending (oldest to newest) and -1 will sort descending (newest to oldest.)

If you use the auto created _id field it has a date embedded in it … so you can use that to order by …

db.foo.find().sort({_id:1});

That will return back all your documents sorted from oldest to newest.

Natural Order

You can also use a Natural Order mentioned above …

db.foo.find().sort({$natural:1});

Again, using 1 or -1 depending on the order you want.

Use .limit()

Lastly, it’s good practice to add a limit when doing this sort of wide open query so you could do either …

db.foo.find().sort({_id:1}).limit(50);

or

db.foo.find().sort({$natural:1}).limit(50);

References
http://stackoverflow.com/questions/4421207/mongodb-how-to-get-the-last-n-records