This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function p = prc(cols,rc) | |
% rc = desired [row,col] position of subplot | |
p = (rc(1) * cols) - (cols - rc(2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rows = 3; | |
cols = 4; | |
figure; | |
for iRow = 1:rows | |
for iCol = 1:cols | |
subplot(rows,cols,prc(cols,[iRow iCol])); | |
title(['Subplot ',num2str(prc(cols,[iRow iCol]))],'fontSize',14); | |
text(0.5,0.5,[num2str(iRow),', ',num2str(iCol)],... | |
'HorizontalAlignment','center','fontsize',14); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function colors = mycmap(filename,varargin) | |
% read image | |
A = imread(filename); | |
% set number of elements to return | |
n = size(A,2); | |
if ~isempty(varargin) | |
n = varargin{1}; | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [idx, val] = closest(testArr,val) | |
tmp = abs(testArr - val); | |
[~, idx] = min(tmp); | |
val = testArr(idx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> ml = 1.3; | |
>> ap = -3.3; | |
>> dv = 7.5; | |
>> S = ratBrainAtlas(ml,ap,dv) | |
S = | |
struct with fields: | |
coronal: [1×1 struct] | |
sagittal: [1×1 struct] | |
horizontal: [1×1 struct] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function r = formatBytes(bytes) | |
s = {'B', 'KB', 'MB', 'GB', 'TB'}; | |
e = floor(log(bytes)/log(1024)); | |
r = sprintf(['%.2f ',s{e+1}], (bytes/(1024^floor(e)))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Myapi < Sinatra::Application | |
ActiveRecord::Base.default_timezone = :utc | |
configure :development, :test do | |
set :host, 'localhost:9999' | |
set :force_ssl, false | |
end | |
configure :staging do | |
set :host, 'my-api-staging.herokuapp.com' | |
set :force_ssl, true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :tddium do | |
desc "post_build_hook" | |
task :post_build_hook do | |
return unless ENV["TDDIUM_MODE"] == "ci" | |
return unless ENV["TDDIUM_BUILD_STATUS"] == "passed" | |
dir = File.expand_path("~/.heroku/") | |
heroku_email = ENV["HEROKU_EMAIL"] | |
heroku_api_key = ENV["HEROKU_API_KEY"] | |
current_branch = `git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3-`.strip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function d1new = equalVectors(d1,d2) | |
% d1new is the 'dimension' of d2 | |
nd2 = numel(d2); | |
if isscalar(d2) | |
nd2 = d2; | |
end | |
d1new = interp1(1:numel(d1),d1,linspace(1,numel(d1),nd2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'spikesorter-sx3' | |
# Get your account sid and auth token from spikesorter.com | |
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
auth_token = 'your_auth_token' | |
@client = SpikeSorterSX3::REST::Client.new(account_sid, auth_token) | |
spikes = @client.spikes | |
.extract( |