I was having a rough time making the test database use transactions when trying out Padrino recently. I added this line to my gemspec:
# Gemfile
group :test do
# ... some gems
gem 'database_cleaner'
# ... some other gems
end
import au.com.bytecode.opencsv.CSVParser | |
import org.apache.spark.rdd.RDD | |
val taxis = sc.textFile("/media/brycemcd/filestore/third_party_data/taxi/trip_fare_1.csv") | |
taxis.cache() | |
case class Trip(medallion: String, | |
hack_license: String, | |
vendor_id: String, |
library('dplyr') | |
library('tidyr') | |
library('ggplot2') | |
temperature_data <- function(dataset, stationName) { | |
dataset %>% | |
filter(STATION_NAME == stationName) %>% | |
mutate(dailyrange = (TMAXF-TMINF)) %>% | |
select(DATE, TMAXF, TMINF, dailyrange) | |
} |
# Plots a graph of retention after exporting data from Mixpanel's retention | |
# feature. See Thoughtbot blog: https://robots.thoughtbot.com/create-a-retention-curve-with-mixpanel-and-google-sheets | |
# and my blog: http://www.brycemcdonnell.com/plotting-user-retention-curves-in-R/ | |
library(lubridate) | |
library(tidyr) | |
library(dplyr) | |
library(ggplot2) | |
## |
unbind C-b | |
unbind l | |
set -g prefix C-e | |
bind C-e send-prefix | |
set -g default-terminal "screen-256color" | |
I was having a rough time making the test database use transactions when trying out Padrino recently. I added this line to my gemspec:
# Gemfile
group :test do
# ... some gems
gem 'database_cleaner'
# ... some other gems
end
" NOTE: currently appends a "^@" to the end of the line and I haven't | |
" taken the time to get rid of that | |
function! LinesChanged() | |
let dif=system('git diff --stat -- '. bufname('%') .'| cut -d"|" -f2 | head -n 1') | |
return dif | |
endfunction | |
" statusbar: | |
set statusline= " clear the line |
# For future Bryce to Google and find... | |
# in irb session: | |
f = File.read("meta/7e/13c49c3d286767984ee2d801df056cb879d2a2"); nil # nil is here so it doesn't barf the contents of the file into the console | |
headers = Marhsal.load(f) | |
headers = headers[0] |
// Load up an mp3 in a FF address bar. | |
// in the browser. Don't let it autoplay. | |
// in FF, the mp3 loads in a video player. Create a var to reference the video player: | |
var v = document.getElementsByTagName("video")[0]; | |
// set the playhead at 0 and then play: | |
v.currentTime = 0; | |
v.pause(); |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
# Takes a URL for a news site (like Huffpo or Yahoo) as input and outputs the Headline | |
url = ARGV[0] | |
resource = NokoGiri::XML(open(url)) |