Skip to content

Instantly share code, notes, and snippets.

View davebridges's full-sized avatar

Dave Bridges davebridges

View GitHub Profile
@davebridges
davebridges / mousedb_access.R
Last active June 13, 2019 17:09
Code for extracting data from mousedb
#To use this you must supply:
#a cohort_id number
#an output datafile ('something.csv')
#the api_key to access the database
#for example:
#raw_data_file <- "Raw MRI Data.csv"
#cohort_id <- 35
#api_key <- 'SEE SLACK FOR THE API KEY'
@noamross
noamross / find_local_tweeps.R
Created August 14, 2017 23:43
A visit to Durham
library(rtweet) #rtweet API creds should already be set up
library(stringi)
library(dplyr)
friends = get_friends(user="noamross")
followers = get_followers("noamross")
tweeps_id = distinct(bind_rows(friends, followers))
tweeps_info = lookup_users(tweeps_id$user_id)
# A regex for a visit to Durham
@robgolding
robgolding / login_required.py
Created July 11, 2012 19:25
Django Class-Based View Mixins: Part 1
class LoginRequiredMixin(object):
"""
View mixin which requires that the user is authenticated.
"""
@method_decorator(login_required)
def dispatch(self, request, *args, **kwargs):
return super(LoginRequiredMixin, self).dispatch(
self, request, *args, **kwargs)
@mages
mages / googleVis_with_knitr_and_RStudio.Rmd
Created May 15, 2012 19:59
Interactive reports in R with knitr and RStudio
My first examples with [***knitr***](http://yihui.name/knitr/)
-----------------------------------------
Let's include some simple R code:
```{r}
1+2
```
That worked.
Let's include a plot:
```{r fig.width=4, fig.height=4}
@magnusdahlstrand
magnusdahlstrand / gist:1923948
Created February 27, 2012 13:58
Remove all ._* and .AppleDouble-files
Remove ._*- and .AppleDouble-files from folders.
Adapted from Torkel's comment on http://hints.macworld.com/article.php?story=20021118060850652
Cred to hiber for suggesting adding -print0/-0 to solve whitespace issue.
See all ._*-files:
find . -name '._*' | more
Remove all ._*-files:
find . -name '._*' -print0 | xargs -0 rm
<?xml version='1.0' encoding="ISO-8859-1"?>
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version='1.0'
>
<xsl:param name="layout">ref</xsl:param>
<!--
Author: