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
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| def plot_top(names, values, n_top=10, | |
| order=None, | |
| alpha=.25, | |
| ax=None, figsize=None): | |
| '''Plot the top N values, then squeeze in the rest | |
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
| library(brms) | |
| library(rstan) | |
| ## Simulate data | |
| bxy = 2 | |
| bxz = 3 | |
| byz = 4 | |
| e = .1 | |
| n = 1000 |
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
| library(tidyverse) | |
| # Arguments: Sigma of old predictor, Sigma of new predictor, N cases | |
| compare_methods = function(s0, s1, n){ | |
| print(c(s0, s1, n)) | |
| y = rnorm(n, 0, 1) | |
| x0 = y + rnorm(n, 0, s0) # Old predictor | |
| x1 = y + rnorm(n, 0, s1) # New predictor to evaluate | |
| m0 = lm(y ~ x0) |
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
| from psychopy import visual | |
| from psychopy.tools.colorspacetools import hsv2rgb | |
| import numpy as np | |
| win = visual.Window( | |
| size=[800, 600], fullscr=False, screen=0, | |
| gammaErrorPolicy='ignore', | |
| color=(1, 1, 1), colorSpace='rgb', units='height') | |
| class CompoundStim(): |
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
| from psychopy import visual, event, core | |
| win = visual.Window(size=(600, 400), fullscr=False, units='height', | |
| color=[1.,1.,1.], colorSpace='rgb', | |
| gammaErrorPolicy='ignore') | |
| my_text = visual.TextStim(win=win, color='black', | |
| pos=[.33, 0], height=.05, wrapWidth=.66, | |
| text='') |
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
| #!/usr/bin/env Rscript | |
| # (Don't forget: `chmod +x dplyr`) | |
| # Copyright 2018 Eoin Travers <eoin.travers@gmail.com> | |
| # | |
| # This file is free software: you may copy, redistribute and/or modify it | |
| # under the terms of the GNU General Public License as published by the | |
| # Free Software Foundation, either version 2 of the License, or (at your | |
| # option) any later version. | |
| # | |
| # This file is distributed in the hope that it will be useful, but |
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
| #!/usr/bin/env python2 | |
| """ | |
| Run this script in the folder that contains all of your Git repositories | |
| to see an ordered summary of your commits from the past N days. | |
| Output is tab-delimited, so suggested usage (to see last month's worth of work) is: | |
| cd ~/git_repo_folder/ | |
| python git-diary.py 30 | column -ts $'\t' | |
| """ |
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
| import re | |
| with open('Paper.txt', 'r') as f: | |
| paper = f.read() | |
| words = paper.split(' ') | |
| refs = [] | |
| go_back_by = 5 # Default number of words to show before year. | |
| last = 0 | |
| for i in range(len(words)): |
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
| // d3.legend.js | |
| // (C) 2012 ziggy.jonsson.nyc@gmail.com | |
| // MIT licence | |
| (function() { | |
| d3.legend = function(g) { | |
| g.each(function() { | |
| var g= d3.select(this), | |
| items = {}, | |
| svg = d3.select(g.property("nearestViewportElement")), |
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
| { | |
| "translatorID": "", | |
| "translatorType": 3, | |
| "label": "Better BibLateX key for Markdown", | |
| "creator": "Eoin Travers. Forked from BibTex key for Markdown, created by liob based on the works of Peter O'Brien, Simon Kornblith and Richard Karnesky", | |
| "target": "bib", | |
| "minVersion": "2.1.9", | |
| "maxVersion": null, | |
| "priority": 200, | |
| "inRepository": true, |