Skip to content

Instantly share code, notes, and snippets.

<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
//-->
@jjsub
jjsub / JavaScript Sieve Of Atkin.js
Created March 8, 2016 15:10 — forked from rizalp/JavaScript Sieve Of Atkin.js
return array of primes below limit using Sieve of Atkin Algorithm http://en.wikipedia.org/wiki/Sieve_of_Atkin #JavaScript #primes
function sieveOfAtkin(limit){
var limitSqrt = Math.sqrt(limit);
var sieve = [];
var n;
//prime start from 2, and 3
sieve[2] = true;
sieve[3] = true;
for (var x = 1; x <= limitSqrt; x++) {
function Type () {}
var types = [
new Array(),
[],
new Boolean(),
true, // remains unchanged
new Date(),
new Error(),
new Function(),
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
The apply() method calls a function with a given this value and arguments provided as an array (or an array-like object).
Note: While the syntax of this function is almost identical to that of call(),
the fundamental difference is that call() accepts an argument list, while apply() accepts a single array of arguments.
Examples
Using apply to chain constructors
You can use apply to chain constructors for an object, similar to Java. In the following example we will create a global Function method called construct, which will enable you to use an array-like object with a constructor instead of an arguments list.
@jjsub
jjsub / basic.html
Last active August 29, 2015 14:24 — forked from BhuvaniSubbiah/basic.html
<html>
<head>
<title>Basic Html Tags</title>
</head>
<body>
<img src ="Path of the file">//imagefile
<b>Hello</b>//bold
<i>hai</i>//italic
<u>Wonderful</u>//underlined
</body>
(function( window ){
window.watchResize = function( callback ){
var resizing;
callback.size = 0;
function done()
{
var curr_size = window.innerWidth;
clearTimeout( resizing );
resizing = null;
// only run on a true resize
/* Modern Modules
Various module dependency loaders/managers essentially wrap up this pattern of module definition into a friendly API */
MyModules.define("bar", [], function() {
function hello(who) {
return "Let me introduce: " + who;
}
return {
hello: hello
};