Skip to content

Instantly share code, notes, and snippets.

View benjaminEwhite's full-sized avatar

Benjamin E White benjaminEwhite

  • Raleigh NC
View GitHub Profile
function makeFunc(a) {
var name = a;
function displayName() {
alert(a);
}
return displayName;
}
var a = 'something';
var myFunc = makeFunc(a);
@benjaminEwhite
benjaminEwhite / main
Created January 22, 2014 19:24
Thinkful FEWD: HTML and CSS files for Street Fighter jQuery project at checkin point 1
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/main.css">
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="js/app.js"></script>
</head>
@benjaminEwhite
benjaminEwhite / index.html
Last active December 30, 2015 22:29
Bare Bones Tip Calculator Code for Thinkful's Programming Fundamentals in Javascript Module
<html>
<head>
<title>Tip Calculator</title>
<script src="script.js"></script>
</head>
<body>
<p>Hey there! Let me calculate that for you.</p>
</body>
</html>
@benjaminEwhite
benjaminEwhite / tip_calculator5.rb
Created October 21, 2013 20:06
Thinkful | Ruby on Rails | Tip Calculator Part 5
require "optparse"
def calculate_rate(base, percentage)
return base * percentage/100
end
def calculate_meal_costs(meal_base, tax_rate, tip_rate)
tax_value = calculate_rate(meal_base, tax_rate)
meal_with_tax = tax_value + meal_base
@benjaminEwhite
benjaminEwhite / tip_calculator2.rb
Created October 21, 2013 20:01
Thinkful | Ruby on Rails | Tip Calculator Part 2
# first we get user inputs for our variables
# and convert them to Floats (they'll initially be strings).
puts "Please enter the cost of your meal (e.g., 22.45): $ "
meal_cost = Float(gets)
puts "Please enter tax rate as a percentage (e.g., 12.5 or 15): "
tax_percent = Float(gets)
puts "Please the tip percentage you'd like to leave (e.g., 18): "
tip_percent = Float(gets)
@benjaminEwhite
benjaminEwhite / tip_calculator1.rb
Last active December 26, 2015 03:59
Thinkful | Ruby on Rails | Tip Calculator Part 1
# first we assign our initial variables
meal_cost = 20.0
tax_percent = 12
tip_percent = 20
# now we compute
tax_value = meal_cost * tax_percent/100
meal_with_tax = meal_cost + tax_value
tip_value = meal_with_tax * tip_percent/100
total_cost = meal_with_tax + tip_value
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')