Skip to content

Instantly share code, notes, and snippets.

#titleBlock {
background-color: rgb(26, 188, 156);
width: 100%;
height: 250px;
padding: 15px;
}
require 'httparty'
require 'json'
require 'nokogiri'
require 'open-uri'
#
# This is a shart script to get demo content to populate an inial set of 'science gists'
# We started by trying to call the elife api directly, but it sucked balls
# then we tried to use content negotiation, but that is also flakey
@bmiles
bmiles / gist:42f979d079f2be7f266e
Created May 10, 2014 12:06
r install gfortran issue
➜ ~ brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: cdec40e4cab0768084c92d9732295a7e337c39be
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.9.2-x86_64
Xcode: 5.1.1
CLT: 5.1.0.0.1.1396320587
@bmiles
bmiles / gist:36552527abec01a8a6bf
Created May 11, 2014 09:02
error when issuing ./configure
checking build system type... x86_64-apple-darwin13.1.0
checking host system type... x86_64-apple-darwin13.1.0
loading site script './config.site'
loading build-specific script './config.site'
checking for pwd... /bin/pwd
checking whether builddir is srcdir... yes
checking for working aclocal... found
checking for working autoconf... missing
checking for working automake... found
checking for working autoheader... missing
@bmiles
bmiles / asc2csv.js
Created May 21, 2014 15:44
small JS that finds and replaces tabs with a comma and renames the file to csv from asc.
var fs = require('fs');
var filePath = process.argv[2];
console.log(filePath);
fs.readFile(filePath, function (err, data) {
if (err) {
return console.log(err);
}
var newFilePath = filePath.replace(/asc/g, 'csv');
@bmiles
bmiles / bin.matlab
Created July 17, 2014 11:38
rebinning a matrix
b = a; #original image
[L W] = size(a); % get dimensions of matrix
% define bin factor
BinW = 8;
BinL = 8;
% chaning the size of matrix b, to binL by ?? then adding 1
@bmiles
bmiles / rebin.R
Last active August 29, 2015 14:04
R function to rebin a matrix by taking averages, then plots the heatmap
# Simple ggplot2 heatmap
# with colorBrewer "spectral" palette
doInstall <- FALSE # Change to FALSE if you don't want packages installed.
toInstall <- c("ggplot2", "reshape2", "RColorBrewer")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
require('rje')
require('reshape2')
# Generate a random matrix
@bmiles
bmiles / Translocation bean plot.R
Created July 30, 2014 14:50
R code to generate beanplot from translocation data.
library('beanplot')
//load CSV data into data frame
df <- data.frame(read.csv('./data/Max_Width.csv'))
//beanplot amplitude column, add colours, add labels
beanplot(df$Peak.Amplitude..nA.,
col=c('#bdc3c7','#1abc9c','#1abc9c'),
show.names= TRUE,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style> div {background-color: #e0e0e0}</style>
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
@bmiles
bmiles / .Rprofile
Created January 17, 2015 12:02
.Rprofile
library('colorout')
setOutputColors256(normal = 70, number = 56, negnum = 56, date = 56, string = 179, const = 202, verbose = FALSE)
library('dplyr')
library('ggplot2')
options(repos=structure(c(CRAN='http://cran.ma.imperial.ac.uk/')))