JavaScript setInterval() Method

JavaScript setInterval() method either call a function evaluates an expression at specified number of milliseconds. This method continues to call/evaluate the expression until window is called. Another way to stop this method is by calling clearInterval() method. Below is a working demo of this useful method.

Hit start..

How to Edit the Hosts File on Mac

In many cases, we need to know whats going on with internet on our Mac. Well, we can take a look at DNS (Domain Name System) and associated cache file. There is another way to get this task done, using Hosts file. Hosts file is always hidden on Mac's /etc folder. It carries hostnames with certain IP address. Our OS and browsers come and check this file for desired hostname with IP address. In particularly, once we write URL on browser's address bar, OS gets in this file for corresponding mapping before going to the DNS server to look for IP address. By the way, hosts file can be used to override the default DNS information.

     Most of the Mac users don't need to worry or touch the Hosts file. Its always ready to get done what it meant to do. However, we need to touch this file in certain cases. We know, it can redirect a domain. Suppose, we are testing a developing server and we don't want others to access it using DNS. We can use Hosts file to make a domain redirect to local address on our machine, we will be able to test our code offline before it becomes online for users.

JavaScript Output

There are several ways to generate output in JavaScript. Each and every scenario depends on our need. These are_

     innerHTML
     document.write()
     console.log()
     window.alert()

Mac Functions for Need of Snipping Tool

Snipping Tool is very popular little utility for Windows users. You can take screenshot with required dimension with it. Is there any option on Mac that can replace this tool?
Well, absolutely. Mac has Grab, which does the same. We will talk about Grab in detail on other post. Right now, we will list couple of options below that are pretty handy_

  • Full Screen:  By pressing COMMAND+SHIFT+3, we can save a screenshot for entire screen to the Desktop.
  • Part of Screen: We can snip a specific area of the screen to the Desktop by pressing COMMAND+SHIFT+4 simultaneously. Once the cursor icon changes to " + ", we need to create a box around the desired section of the screen and release.
  • The third option is GRAB that we mentioned earlier. Its a very light but very useful tool that is the best alternative for Windows Snipping Tool.
For Detail/Additional info_[Post is under construction]

Triangular Number


Triangular Number

Triangular Form: [A x (A + 1) / 2]
A =
=>
=>

Tweet with 280 Characters

Twitter declared 280 characters limit for tweeting (current 140) but all users will not be able to use the offer yet. Its only for test on selected accounts. However, there is a workaround. @Prof9 created a little client side script that does the trick_

_Download Tampermonkey and install it on your browser. 
_Head to this Gist, click the “raw” button, and install script to Tampermonkey.
_Create tweet with more than 140 characters, make sure the script in running in Tampermonkey. 
_You have to refresh the page every time you jump on different pages. 
_This is pretty harmless script, only bypasses the tweet button limit.
_Happy Tweeting!!!

Tic Tac Toe

Tic Tac Toe
TIC TAC TOE
X wins: 0
O wins: 0
Draws: 0

Age Calculator_Basic


Age Calculator_Basic

Date Format: Month/Date/Year
Birth Date
Recent DateUse Today
=>
[ Round down ]
=>

Syntax Highlighting on Blogger with Github Gist

Here is the most convenient way to syntax highlighting on a blogger post..

  
       1. Go to https://gist.github.com/
       2. Create a gist with your code. Use 'Create Public Gist' button to make it public.
       3. Copy the embed script.
       4. Paste the link on your blogger post in HTML editing mode.

Above little chunk of code will look like in the box below using this script: 
<script src="https://gist.github.com/sayham-sjb/39d0587442addf2ec0bfd1498de2e2b8.js"></script>

Your's will look different since I've different CSS applied on mine. Click GIST to see original.

Click Count with JavaScript


Button was clicked - 0 - times.


     The above click event can easily be triggered by a little script. We can use that for our blog or in web game to collect click. Check out the following script_

     Here we used getElementById() to get certain elements and set an onClick() attribute and incremented the count number. This the most easiest way to get this task done. However, there are so many other ways too.

Grab The Button...

Grab the above button and add to your blog or website to get easy access to Virtual Species. Simply click the textbox, copy the code and paste where you want to see the button. That's it!