Skip to content

Instantly share code, notes, and snippets.

@abubelinha
Last active April 3, 2020 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abubelinha/84f00023ed45ff8c754ce113abf7ce09 to your computer and use it in GitHub Desktop.
Save abubelinha/84f00023ed45ff8c754ce113abf7ce09 to your computer and use it in GitHub Desktop.
index.html/js bl.ocks example
license: gpl-3.0
height: 500
scrolling: no
border: yes

You can access this bl.ock here

bl.ocks documentation:

About Bl.ocks

Prose-only Blocks

Parts of a bl.ock:

README.md file

You can embed code in your .md, and it will be syntax-highlighted:

js code:

function shuffle(array) {
  var m = array.length, t, i;
  /* While there remain elements to shuffle, pick one and swap it with the current element */
  while (m) {
    i = Math.floor(Math.random() * m--);
    t = array[m];
    array[m] = array[i];
    array[i] = t;
  }
  return array;
}

... and back to normal text

index.html file

.block file (YAML license):

  • license: gpl-3.0
  • height: 500
  • scrolling: no
  • border: yes
<html>
<head>
</head>
<body>
<script type="text/javascript">
function ran() {
document.getElementById("chiripa").innerHTML = Math.random();
}
</script>
<div style="background:yellow;">
<h1>Hi bl.ocks </h1>
Random number:
<h3 id="chiripa" onclick="ran();">click me!</h3>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment