Live JS Demo by Lopez Hugo
A Pen by Lopez Hugo on CodePen.
Live JS Demo by Lopez Hugo
A Pen by Lopez Hugo on CodePen.
d3js: Create an HTML select box using d3.js and create a paragraph referencing the selection.
A good friend asked me how functions work under the covers, so I wrote up this quick explanation. Corners are cut for brevity, but I hope it will convey the general idea.
The three assembly language programs below implement the following (super simple) recursive function:
| # Plotting 3D maps using OpenStreetMap and RGL. For info see: | |
| # http://geotheory.co.uk/blog/2013/04/26/plotting-3d-maps-with-rgl/ | |
| map3d <- function(map, ...){ | |
| if(length(map$tiles)!=1){stop("multiple tiles not implemented") } | |
| nx = map$tiles[[1]]$xres | |
| ny = map$tiles[[1]]$yres | |
| xmin = map$tiles[[1]]$bbox$p1[1] | |
| xmax = map$tiles[[1]]$bbox$p2[1] | |
| ymin = map$tiles[[1]]$bbox$p1[2] |
States will adjust in size relative to the width of the container div, which allows SVG elements to be appropriately sized regardless of device size or screen resolution, making it a good way to integrate D3 and Bootstrap.
Click "Open in a new window", change the size of your browser window, and the states will scale with it. *Will not work in the standard bl.ocks.org view
Please let me know if there is a better/native way to do this!
| <!DOCTYPE> | |
| <html> | |
| <head> | |
| <script src="http://chmille4.github.com/Scribl/js/Scribl.1.0.min.js"></script> | |
| <script src="http://chmille4.github.com/Scribl/js/genbankData.js"></script> | |
| <link rel="stylesheet" id="themeCSS" href="http://chmille4.github.com/Scribl/css/iThing.css"> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script> | |
| <script src="http://static.tumblr.com/fcdode8/Giymeu17u/jquery.mousewheel.min.js"></script> | |
| <script src="http://static.tumblr.com/fcdode8/WVbmeu18t/jqallrangesliders-min.js"></script> |
| # Truly the most ridiculous thing I could think of. | |
| doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
| toInstall <- c("XML", "png", "devtools", "RCurl") | |
| if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
| lapply(toInstall, library, character.only = TRUE) | |
| # Some helper functions, lineFinder and makeTable | |
| source_gist("818983") | |
| source_gist("818986") |
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| """ | |
| Join R1 and R2, or print unpaired reads of R1 or R2 | |
| This script assumes there is whitespace separating the readname from the pair number: | |
| > < | |
| @HW-ST997:140:D0UA5ACXX:8:1101:1497:2138 1:N:0:ATCACG | |
| @HW-ST997:140:D0UA5ACXX:8:1101:1497:2138 2:N:0:ATCACG |
| % Copyright (c) 2010 Michael Ummels <[email protected]> | |
| % | |
| % Permission to use, copy, modify, and/or distribute this software for any | |
| % purpose with or without fee is hereby granted, provided that the above | |
| % copyright notice and this permission notice appear in all copies. | |
| % | |
| % THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| % WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| % MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
| % ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| ;; Datomic example code | |
| (use '[datomic.api :only (db q) :as d]) | |
| ;; ?answer binds a scalar | |
| (q '[:find ?answer :in ?answer] | |
| 42) | |
| ;; of course you can bind more than one of anything | |
| (q '[:find ?last ?first :in ?last ?first] | |
| "Doe" "John") |