Skip to content

Instantly share code, notes, and snippets.

View rosiecakes's full-sized avatar

rosie ❤ rosiecakes

  • Connecticut
View GitHub Profile
DB: https://lagunita.stanford.edu/c4x/DB/SQL/asset/moviedata.html
For all cases where the same reviewer rated the same movie twice and gave it a higher rating the second time, return the reviewer's name and the title of the movie.
SELECT name, title
FROM movie, reviewer,
(SELECT rating1.rID, rating1.mID
FROM rating rating1, rating rating2
WHERE rating1.rID = rating2.rID
AND rating1.mID = rating2.mID
@rosiecakes
rosiecakes / dataquest numpy intro.py
Last active October 29, 2016 00:16
dataquest numpy intro, list comp, slicing, map
# Year -- the year the data in the row is for.
# WHO Region -- the region in which the country is located.
# Country -- the country the data is for.
# Beverage Types -- the type of beverage the data is for.
# Display Value -- the number of liters, on average, of the beverage type a citizen of the country drank in the given year.
# Use the csv module to read world_alcohol.csv into the variable world_alcohol.
# You can use the csv.reader method to accomplish this.
# world_alcohol should be a list of lists.
# Extract the first column of world_alcohol, and assign it to the variable years.
@rosiecakes
rosiecakes / dna.py
Last active October 18, 2016 17:03
Cute codecademy challenge
sample = ['GTA','GGG','CAC']
def read_dna(dna_file):
dna_data = ''
with open(dna_file, 'r') as f:
for line in f:
dna_data += line
return dna_data
function multiplyByThree(array) {
var multiplier = 3;
// Handle undefined or null inputs
if (!array) {
throw new Error("Argument is undefined or null");
}
// Handle non-array inputs
if (!Array.isArray(array)) {
@rosiecakes
rosiecakes / default
Last active May 13, 2016 20:37 — forked from DarrylDias/default
nginx config for gravcms
server {
listen 80;
server_name localhost; # Change this with your domain name
root /usr/share/nginx/html; # The place were you have setup your Grav install;
index index.php;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
def find_next_prime(n):
n+=1
for i in range(2, n):
if n%i == 0:
n += 1
else:
print n
pass
find_next_prime(6)