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
#!python3 | |
def square_up(n): | |
"""Simple test cases in docstring | |
>>> square_up(2) | |
[0, 1, 2, 1] | |
>>> square_up(3) | |
[0, 0, 1, 0, 2, 1, 3, 2, 1] | |
>>> square_up(4) |
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 React, { Component } from 'react'; | |
import { Route, Redirect } from 'react-router' | |
class Home extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
toLogin: false, | |
}; | |
this.handleClick = this.handleClick.bind(this); |
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 React, { Component } from 'react'; | |
class Home extends Component { | |
render() { | |
return ( | |
<div> | |
<h1>Make School Club App</h1> | |
<button onClick={() => window.location.href = '/dashboard'}>Login</button> | |
</div> | |
); |
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" | |
) | |
// Abbreviate should have a comment documenting it. | |
func Abbreviate(s string) string { | |
var acronym string | |
// fmt.Println(acronym) |
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 accumulate | |
import ( | |
"strings" | |
) | |
// Accumulate returns all caps string | |
func Accumulate(s []string) []string { | |
// var newSlice []string | |
for pos, word := range s { |
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
# Instructions / Question: | |
# Given a standard English sentence passed in as a string, | |
# write a method that will return a sentence comprised of the same words, | |
# but sorted by their first letter. | |
# However, the method of sorting has a twist to it: | |
# all words that begin with a lowercase letter should be | |
# at the beginning of the sorted sentence, | |
# and sorted in ascending order. All words that begin with | |
# an uppercase letter should come after that, and should be sorted |
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 _find_node_recursive(self, item, node): | |
"""Return the node containing the given item in this binary search tree, | |
or None if the given item is not found. Search is performed recursively | |
starting from the given node (give the root node to start recursion). | |
TODO: Best case running time: ??? under what conditions? | |
TODO: Worst case running time: ??? under what conditions?""" | |
# Check if starting node exists | |
if node is None: | |
# Not found (base case) | |
return None |
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
const User = require('../models/user'); | |
const jwt = require('jsonwebtoken'); | |
function checkAuth (req, res, next) { | |
if (req.cookies && req.cookies.nToken) { | |
const uid = jwt.decode(req.cookies.nToken, process.env.SECRET)._id; | |
User.findById(uid).then(user => { | |
req.user = user; | |
return next(); | |
}); |
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 string | |
import sys | |
def puzzle(ds, b): | |
v = {c: i for i, c in enumerate(string.printable[:36])} | |
return sum(v[d] * b**e for e, d in enumerate(ds[::-1])) | |
if __name__ == '__main__': |
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
const chai = require('chai'); | |
const chaiHttp = require('chai-http'); | |
const server = require('../server'); | |
const should = chai.should(); | |
const Pet = require('../models/pet'); | |
// BETTER TEST COMING SOON! | |
const fido = { |
OlderNewer