This file contains 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 Hash | |
def except(*blacklist) | |
self.reject {|key, value| blacklist.include?(key) } | |
end | |
def only(*whitelist) | |
self.reject {|key, value| !whitelist.include?(key) } | |
end | |
end | |
This file contains 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 'benchmark' | |
require 'andand' | |
class Hash | |
def except(*blacklist) | |
{}.tap do |h| | |
(keys - blacklist).each { |k| h[k] = self[k] } | |
end | |
end | |
This file contains 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
#include <SDL/SDL.h> | |
#include <SDL/SDL_thread.h> | |
#include <cmath> | |
#include <iostream> | |
using namespace std; | |
double scale = 1.0; | |
double x_offset = 0.0, y_offset = 0.0; |
This file contains 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
/* This program uses SDL. | |
* To install: | |
* | |
* sudo apt-get install libsdl1.2-dev | |
* | |
* To compile: | |
* | |
* gcc -lSDL filename.c | |
* | |
*/ |
This file contains 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
#include <SDL/SDL.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <math.h> | |
#define SIZE 800 | |
#define PRECISION 300000 | |
struct paird{ | |
double x, y; |
This file contains 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 ruby | |
grammar, iterations, extra = ARGV | |
if grammar == nil or !File.exists?(grammar) | |
puts "no grammar file" | |
exit | |
end | |
symbols = {} |
This file contains 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
data2006 <- read.csv("census2006.csv", header = TRUE) | |
data1986 <- read.csv("census1986.csv", header = TRUE) | |
# Get the CPI for 1986, 2006, and 2010 | |
cpi2006 <- 1.091 | |
cpi1986 <- 0.656 | |
cpi2010 <- 1.165 | |
calc_avg <- function(w1986, w2006, message, png_file){ | |
# scale by CPIs to give 2010 dollars |
This file contains 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
data2006 <- read.csv("census2006.csv", header = TRUE) | |
data1986 <- read.csv("census1986.csv", header = TRUE) | |
# Get the CPI for 1986, 2006, and 2010 | |
cpi2006 <- 1.091 | |
cpi1986 <- 0.656 | |
cpi2010 <- 1.165 | |
calc_avg <- function(w1986, w2006, message, png_file){ | |
# scale by CPIs to give 2010 dollars |
This file contains 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
[1] "Average wages for degree in education:" | |
[1] "Confidence for 1986: 45951.512708 to 47462.916536" | |
[1] "Confidence for 2006: 48453.487226 to 49640.726011" | |
[1] "Standard Deviation for 1986: 28759.942381" | |
[1] "Standard Deviation for 2006: 37696.910023" | |
[1] "Median Confidence for 1986: 49299.946203 to 51002.542615" | |
[1] "Median Confidence for 2006: 47308.440547 to 48645.865039" | |
[1] "" | |
[1] "Average wages for degree in fine arts:" | |
[1] "Confidence for 1986: 30804.704353 to 34896.729876" |
This file contains 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
oil = read.csv("oil.csv", header = T) | |
# convert cubic metres to barrels | |
total = ts(oil$Total * 6.28981077 / 1000, start = 1971, end = 2010) | |
t = 1:length(total) | |
linear = lm(total ~ t) | |
expn = lm(log(total) ~ t) | |
# do a linear model |
OlderNewer