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
print("Starting analysis of active flag on products count"); | |
print("This may take a little while, please wait ...."); | |
var active = db.products.find({active:true}).count(); | |
var inactive = db.products.find({active:false}).count(); | |
var null_flag = db.products.find({active:null}).count(); | |
var products = db.products.find().count(); | |
var has_flag = db.products.find({active:{$exists:true}}).count(); | |
var no_flag = db.products.find({active:{$exists:false}}).count(); |
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
db.categories.update({slug:"root.v2.tops"}, {$set: {display_name:"All Shirts and Sweaters"}}, {multi:false}); | |
db.categories.update({slug:"root.v2.bottoms"}, {$set: {display_name: "All Pants and Shorts"}}, {multi:false}); | |
db.categories.update({slug:"root.v2.dresses"}, {$set: {display_name: "All Dresses"}}, {multi:false}); | |
db.categories.update({slug:"root.v2.suits"}, {$set: {display_name: "All Suits and Jackets"}}, {multi:false}); | |
db.categories.update({slug:"root.v2.activewear"}, {$set: {display_name:"All Activewear"}}, {multi:false}); | |
db.categories.update({slug:"root.v2.outerwear"}, {$set: {display_name:"All Outerwear"}}, {multi:false}); | |
db.categories.update({slug:"root.v2.underwear"}, {$set: {display_name:"All Underwear"}}, {multi:false}); | |
db.categories.update({slug:"root.v2.shoes"}, {$set: {display_name: "All Shoes"}}, {multi:false}); | |
db.categories.update({slug:"root.v2.accessories"}, {$set: {display_name:"All Accessories"}}, {multi:false}); |
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
first_name | last_name | ||
---|---|---|---|
ben | bengfort | bbengfort@gmail.com | |
sean | murphy | murphsp1@gmail.com | |
bob | jones | bob@example.com |
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
import os | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
PATH = os.path.abspath('nba_players.csv') | |
def read_data(path=PATH): | |
return pd.DataFrame(pd.read_csv(PATH)) |
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 Person(object): | |
def __init__(self, name, age, profile): | |
self.name = name | |
self.age = age | |
self.profile = profile | |
def __getattr__(self, key): | |
if hasattr(self, key): | |
return getattr(self, key) |
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 python | |
# coursenotes | |
# A helper to come up with Course Notes Titles | |
# | |
# Author: Benjamin Bengfort <benjamin@bengfort.com> | |
# Created: Thu Sep 04 15:00:55 2014 -0400 | |
# | |
# Copyright (C) 2014 Bengfort.com | |
# For license information, see LICENSE.txt | |
# |
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
""" | |
Code for class | |
""" | |
tooshort = ["a", "an", "the", "at", "by", "for", "in", "of", "on", "to", | |
"up", "and", "as", "but", "it", "or", "nor"] | |
def apa_title(text): | |
""" |
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
import json | |
import requests | |
weather_url = "http://api.openweathermap.org/data/2.5/weather?q=" | |
def kelvin_to_fahr(temp): | |
return ((9/5.0) * (temp-273) + 32) | |
def get_weather(city): | |
url = weather_url + city |
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 word_count(path): | |
counts = { | |
'line': 0, | |
'word': 0, | |
'char': 0 | |
} | |
with open(path, 'r') as f: | |
for line in f: |
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
package main | |
import ( | |
"fmt" | |
) | |
type A struct{ | |
name string | |
} |