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
# Customer Check-in Script | |
import requests | |
def init(): | |
checkin_type = raw_input('Enter 1 for "points" or 2 for "punches": ') | |
new_customer_data = create_customer() | |
if checkin_type == '1': | |
checkin_customer('points', new_customer_data) |
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
var express = require('express'); | |
var ejs = require('ejs'); //embedded javascript template engine | |
var app = express.createServer(express.logger()); | |
var mongoose = require('mongoose'); // include Mongoose MongoDB library | |
var schema = mongoose.Schema; | |
var requestURL = require('request'); |
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
//Twitter-Stepper Test | |
#include <SPI.h> | |
#include <Ethernet.h> | |
#include <TextFinder.h> | |
#include <Stepper.h> | |
#define STEPS 200 | |
// MAC address and server DNS: |
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
//Twitter-Stepper Test | |
#include <SPI.h> | |
#include <Ethernet.h> | |
#include <TextFinder.h> | |
#include <Stepper.h> | |
#define STEPS 200 | |
// interval declarations |
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
snf <- read.csv("http://www.jakeporway.com/teaching/data/snf_2.csv", as.is=TRUE) | |
# Part 1 | |
# Write code to return the percentage of people who were frisked for each race. | |
race.code = c(-1,1,2,3,4,5,6) | |
for(i in race.code) { |
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
snf <- read.csv("http://www.jakeporway.com/teaching/data/snf_2.csv", as.is=TRUE) | |
crime.abbr = substr(snf$crime.suspected, 1, 3) | |
snf$crime.abbr = crime.abbr | |
race.code = c(-1,1,2,3,4,5,6) | |
for(i in race.code) { | |
# create subset | |
which.race = which(snf$race == i) |
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] "racecode -1 results:" | |
subset.race.crime.abbr | |
FEL MIS CPW | |
566 229 202 | |
[1] "racecode 1 results:" | |
subset.race.crime.abbr | |
FEL MIS CPW | |
10744 4487 4009 | |
[1] "racecode 2 results:" | |
subset.race.crime.abbr |
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
snf <- read.csv("http://www.jakeporway.com/teaching/data/snf_2.csv", as.is=TRUE) | |
# First create a subset of the data only consisting of “good” weights and heights. | |
clean.subset = snf[snf$height > 40 & snf$weight > 90 & snf$weight < 400, ] | |
# Add a BMI variable to our dataset, where BMI is computed as (weight)*703/(height*height). | |
bmi = (clean.subset$weight)*703/(clean.subset$height*clean.subset$height) | |
# What percentage of people with BMI’s greater than or equal to 30 who were stopped were | |
# ultimately arrested? | |
obese.subset = clean.subset[bmi >= 30, ] | |
obese.arrested.subset = which(obese.subset$arrested == 1) |
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
# custom command prompt | |
export PS1="\W > " | |
# bash aliases | |
alias la='ls -la' | |
alias lah='ls -lah' | |
alias move='mv -i' | |
alias rename='mv' | |
alias remove='rm -i' | |
alias rmdir='rm -rf' |
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 code to find the 5 most popular words used in the descriptions of our users | |
# use strsplit to seperate the words in the description | |
split.description = strsplit(tweets$description, split = "[^a-zA-Z0-9]+") | |
# use unlist() to turn the list into a vector | |
split.description = unlist(strsplit(tweets$description, split = "[^a-zA-Z0-9]+")) | |
# use tolower() to convert all words to lower case to reduce duplicates | |
split.description = tolower(unlist(strsplit(tweets$description, split = "[^a-zA-Z0-9]+"))) | |
# count the number of occurances of each word, and pull the top five | |
rev(sort(table(split.description)))[1:5] |
OlderNewer