Skip to content

Instantly share code, notes, and snippets.

View zbjornson's full-sized avatar

Zach Bjornson zbjornson

View GitHub Profile
@zbjornson
zbjornson / index.html
Created April 29, 2012 08:49
D3 Slopegraph I
<!DOCTYPE html>
<html>
<head>
<title>Life Expectancy Slope Graph: 1960 &ndash; 2011</title>
<script src="http://mbostock.github.com/d3/d3.v2.min.js?2.8.1"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body { color: #444; background: #f3f3f3; font: normal 12px "Adobe Garamond Pro", "Palatino", serif; margin: 2em; }
header { margin: 0 0 20px 220px; border-bottom: 1px solid #6c6c6c; width: 360px; position: relative; }
h1 { font-size: 28px; font-weight: normal; text-shadow: #fff 0 1px 0; margin: 0 0 0 0; padding: 0; }
@zbjornson
zbjornson / index.html
Created May 2, 2012 02:13
D3 Slopegraph II
<!DOCTYPE html>
<html>
<head>
<title>Life Expectancy Slope Graph: 1960 &ndash; 2011</title>
<script src="http://mbostock.github.com/d3/d3.v2.min.js?2.8.1"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body { color: #444; background: #f3f3f3; font: normal 12px "Adobe Garamond Pro", "Palatino", serif; margin: 2em; }
header { margin: 0 0 20px 220px; border-bottom: 1px solid #6c6c6c; width: 360px; position: relative; }
h1 { font-size: 16px; font-weight: normal; text-shadow: #fff 0 1px 0; margin: 0 0 0 0; padding: 0; }
@zbjornson
zbjornson / output.R
Created October 5, 2012 03:37 — forked from mlinderm/output.R
Script for up-sampling additional FCS files - v1.1
#!/usr/bin/env Rscript
# Run this script in your SPADE analysis directory. You will need
# to copy some lines from your runSPADE.R file.
# Set the panel files as the vector of all the files, with the "parent" file as the reference_file.
PANELS <- list(
list(
panel_files=c("20071001-u937.002.fcs"),
median_cols=NULL,
@zbjornson
zbjornson / colorGradientCalculator.js
Last active August 11, 2016 19:25
First attempt at hand-writing an asm.js module.
// Interpolates through 10 RGB values, given a value and its domain
colorGradientCalculator = function (stdlib, foreign, heap) {
"use asm";
var rgb = new stdlib.Uint8Array(heap);
var imul = stdlib.Math.imul;
var floor = stdlib.Math.floor;
var lowIndex = 0;
var partial = 0.0;
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css">
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg)">
<scene id="scene1">
<label t="translate(0,346)">
@zbjornson
zbjornson / LICENSE
Last active December 20, 2015 08:39 — forked from dfm/LICENSE
Copyright (c) 2012–2013 Daniel Foreman-Mackey
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css">
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}
@font-face {
font-family: "xkcd";
src: url('http://antiyawn.com/uploads/Humor-Sans.ttf');
}
@zbjornson
zbjornson / make_specs.rb
Created December 17, 2013 05:28
Designed to rough-out the spec folder of your Ruby on Rails application. For example, you have a ton of models living in WEB-INF/app/models and want WEB-INF/spec/models to have corresponding model_xxx_spec.rb files, complete with the header (e.g. schema, copyright--anything in the top of the file that starts with a #) and "describe #{method}" st…
puts "in #{Dir.pwd}\n"
Dir.entries("app/helpers").each do |file_name|
file_path = "#{Dir.pwd}/app/helpers/#{file_name}"
puts "Processing #{file_name}\n"
unless File.directory?(file_path)
spec_file_name = file_name.sub(/\.rb/, "_spec.rb")
unless File.file?("spec/helpers/#{spec_file_name}")
class_name = nil
var buf1 = new Buffer(1024);
for (var i = 0; i < 1024; i++) {
buf1[i] = i
}
function toArrayBuffer(buffer) {
var ab = new ArrayBuffer(buffer.length);
var view = new Uint8Array(ab);
for (var i = 0; i < buffer.length; ++i) {
function flip() {
var flipper = new Uint8Array(4 * 10000);
flipFloat(flipper, 10000, 4);
}
function flipFloat(flipper, iMax, eSize) {
for (var i = 0; i < iMax; i += eSize) {
var t = flipper[i];
// Toggle this line:
if (t === undefined) {}