Skip to content

Instantly share code, notes, and snippets.

@johnotu
johnotu / API.md
Created July 14, 2017 06:45 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@johnotu
johnotu / addressbook.html
Created January 2, 2017 11:18
A Simple Addressbook using a DevLess Backend
<!DOCTYPE html>
<html>
<head>
<title>Address Book</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css">
button{margin: 0 20px;}
</style>
</head>
<body>
def earliest_letter word
#word = word.downcase
earliest = word[0]
word.split('').each do |letter|
if letter < earliest
earliest = letter
end
end
earliest
end
# Class activity 1
def list_range(list_):
if len(list_) == 1:
return [list_[0]]
smallest = list_[0]
largest = list_[0]
for item in list_:
if item > largest:
largest = item
elif item < smallest:
# Determine if a number is a prime number
def square_root(n,d)
g1 = (n * 1.0) / 2
g2 = (g1 + (n / g1)) / 2
while (g1 - g2).abs >= d
g1 = g2
g2 = (g1 + (n / g1)) / 2
end
g2
end
def square_root (n,d)
g1 = (n* 1.0) / 2
g2 = (g1 + (n /g1)) /2
while (g1 - g2).abs >= d
g1 = g2
g2 = (g1 + (n / g1)) / 2
end
g2
end