It's easiest to learn by example. Take the example on the bl.ocks home page:
http://bl.ocks.org/mbostock/1353700
Now to see the gist that generated it, just take the id number from the end of the url and appent it the gist url, like so:
http://gist.github.com/1353700
That gist contains 3 files, but two are optional. The only requirement for a block to display is to have index.html. That file should contain your a full html file with your js script any includes to cdn resources like d3. Optionally, you could put your javascript code in a separate file and add that to the gist, and then link to it from your index.html file.
You can also add a README.md and thumbnail.png, if you'd like to provide a description of your example and an image for it. This is explained on the bl.ocks home page as well.
Hope that helps.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…