Skip to content

Instantly share code, notes, and snippets.

View calthoff's full-sized avatar

Cory Althoff calthoff

View GitHub Profile
# This program is chapter 14 challenge one:
class Shape():
def __init__(self, shape):
self.shape = shape
def what_am_i(self):
print("I am a {}".format(self.shape))
function getMiddle(s){
var m = s.length / 2
if (s.length % 2 == 0){
return s.slice(m - 1, m + 1)
}
return s.slice(m, m + 1)
}
import random
def rock_paper_scissors():
options = ["rock", "paper", "scissors"]
wins = {"rock": "scissors", "scissors": "paper", "paper": "rock"}
player_wins = 0
comp_wins = 0
player_pick = None
name = input("What is your name?")
import json, requests
resp = requests.get(url=url, params=params)
data = json.loads(resp.text)
extends signin-layout
block content
script(src="https://cdn.firebase.com/libs/firebaseui/2.4.1/firebaseui.js")
link(href='https://cdn.firebase.com/libs/firebaseui/2.4.1/firebaseui.css', rel='stylesheet')
script.
// FirebaseUI config.
var uiConfig = {
signInSuccessUrl: '/login',
signInOptions: [
router.post('/login', function (req, res, next) {
var uid = req.body.uid // query
var displayName = req.body.display_name
var photoURL = req.body.photo_url
var email = req.body.email
var accessToken = req.body.authToken
if (uid != null) {
req.session.uid = uid
req.session.accessToken = accessToken
script(src="https://cdn.firebase.com/libs/firebaseui/2.4.1/firebaseui.js")
link(href='https://cdn.firebase.com/libs/firebaseui/2.4.1/firebaseui.css', rel='stylesheet')
script.
// FirebaseUI config.
var uiConfig = {
signInSuccessUrl: '/login',
signInOptions: [
// Leave the lines as is for the providers you want to offer your users.
//firebase.auth.GoogleAuthProvider.PROVIDER_ID,
firebase.auth.FacebookAuthProvider.PROVIDER_ID,
def hangman(word):
wrong = 0
stages = ["",
"________ ",
"| ",
"| | ",
"| 0 ",
"| /|\ ",
"| / \ ",
"| "
while wrong < len(stages) - 1:
print("\n")
msg = "Guess a letter"
char = input(msg)
if char in remaining_letters:
cind = remaining_letters.index(char)
board[cind] = char
remaining_letters[cind] = '$'
else:
wrong += 1
if not win:
print("\n".join(stages[0: wrong]))
print("You lose! It was {}.".format(word))