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
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<style type="text/css"> | |
.axis path, | |
.axis line { | |
fill: none; | |
stroke: black; | |
shape-rendering: crispEdges; |
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
<meta charset="utf-8"> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
</head> | |
<body> | |
<button class="btn btn-mini" id="button">Transition</button> | |
<script type="text/javascript"> | |
var svg = d3.select("body") | |
.append("svg") |
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
year | Bottom bracket | Taxable Income upto | Top bracket | Taxable Income over | Party | |
---|---|---|---|---|---|---|
1913 | 1 | 20000 | 7 | 500000 | D | |
1914 | 1 | 20000 | 7 | 500000 | D | |
1915 | 1 | 20000 | 7 | 500000 | D | |
1916 | 2 | 20000 | 15 | 2000000 | D | |
1917 | 2 | 2000 | 67 | 2000000 | D | |
1918 | 6 | 4000 | 77 | 1000000 | D | |
1919 | 4 | 4000 | 73 | 1000000 | D | |
1920 | 4 | 4000 | 73 | 1000000 | D | |
1921 | 4 | 4000 | 73 | 1000000 | R |
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/Rscript | |
squareCDF <- function(n=100){ | |
# create random data | |
user_id <- seq(1,n) | |
payment_id <- seq(101,n+100) | |
payment_amount <- rnorm(n, mean= 100, sd=50) | |
is_card_present <- sample(0:1, n, replace=T) | |
data <- data.frame(user_id, payment_id, payment_amount, is_card_present) | |
# calculate ECDF |
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
library('RJSONIO') | |
library('plyr') | |
# get data | |
source <- "http://dl.dropbox.com/u/274/readings_formatted.json" | |
data_raw <- fromJSON(source) | |
# format data into dataframe | |
data <- do.call('rbind.fill', lapply(data_raw, as.data.frame)) | |
data$timestamp <- as.POSIXlt(data$timestamp) |
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
# | |
# write a function that takes a string of text and returns true if | |
# the parentheses, brackets, and braces are balanced and false otherwise. | |
# | |
# Example: | |
# balanceParens('[](){}'); // true | |
# balanceParens('[({})]'); // true | |
# balanceParens('[(]{)}'); // false | |
# | |
# Step 3: |
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 CommentsController < ApplicationController | |
before_filter :authenticate_user! | |
def index | |
@comments = Post.includes(:comments).find(params[:post_id]) | |
end | |
def create | |
@post = Post.find(params[:post_id]) | |
@comment = @post.comments.build(comment_params) |
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
def index | |
users = User.includes(:posts) | |
users.each do |u| | |
puts u.posts.limit(3) | |
end | |
@comment = Comment.new | |
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
#!/bin/bash | |
HELP_STR="please provide location of .iso" | |
if [ "$#" -lt 1 ]; then | |
echo $HELP_STR | |
else | |
echo "`diskutil list`" | |
echo "===============" | |
echo "enter disk to eject" | |
echo -e ">> \c" | |
read word |
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
// for https://github.com/MobileChromeApps/mobile-chrome-apps/blob/master/docs/NextSteps.md | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
image_resize: { | |
options: { overwrite: true, upscale: true, crop: true }, | |
icon_16: { | |
options: { width: 16, height: 16 }, | |
files: { 'www/assets/icon16.png':'www/assets/icon.png' } | |
}, |
OlderNewer