Skip to content

Instantly share code, notes, and snippets.

View bootcoder's full-sized avatar

Hunter Chapman bootcoder

View GitHub Profile
@bootcoder
bootcoder / gist:9405030
Created March 7, 2014 04:01
get_grade inject
def get_grade(array)
average = array.inject(:+).to_f / array.length
case average
when 0..59
"F"
when 60..69
"D"
when 70..79
"C"
// pseudo for u1_w2_c5.js
//
// write 3 functions to calculate the sum, mean and median of even and odd arrays
// create variable total and set equal to 0
//
// Sum
// create a function sum, that takes a single input as an argument.
//
@bootcoder
bootcoder / gist:9729321
Last active August 29, 2015 13:57
code combat dressed up
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
var player = {
name: "Eddie Murphy",
};
var ogre = {
@bootcoder
bootcoder / gist:9966851
Last active August 29, 2015 13:58
group cipher
def north_korean_cipher(coded_sentence)
input = coded_sentence.downcase.split("") # takes the input and splits each letter into its own string. Check out this method in IRB to see how it works! Also refer to the ruby docs.
decoded_sentence = [] #blank array
cipher = {"e" => "a", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash
"f" => "b", # the best data structure for this problem? What are the pros and cons of hashes?
"g" => "c",
"h" => "d",
"i" => "e",
"j" => "f",
"k" => "g",
@bootcoder
bootcoder / roman_nums.rb
Created May 13, 2014 00:31
roman_nums with aki
# ORIGINAL CODE (NOT ALTERED)
# def to_roman(num)
# roman_values = { 'M'=>1000,
# 'D'=>500,
# 'C'=>100,
# 'L'=>50,
# 'X'=>10,
# 'V'=>5,
# 'I'=>1}
@bootcoder
bootcoder / 0_reuse_code.js
Created June 16, 2014 21:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bootcoder
bootcoder / gist:096d0d7baddb1a806893
Last active August 29, 2015 14:03
metagame schema
####################################
####################################
####################################
####### METAGAME ###########
####### SCHEMAS ###########
####### ###########
####### Contributors ###########
####### ###########
####### BootCoder ###########
####### MisterDamon ###########
var handleBarListener = function() {
$(".ajax-private-profile-button").on("ajax:success", function(event, data, status, xhr){
console.log("INSIDE ajax-private-profile-button");
console.log(data);
$(".old-profile").fadeOut("slow");
setTimeout(function(){$(".private-profile-handlebars").fadeIn();}, 1000);
var templateIndexSource = $(".private-profile-template").html();
// debugger;
// console.log(templateIndexSource);
@bootcoder
bootcoder / application.js
Created April 14, 2015 16:51
some dummy js
$(document).ready(function() {
// This is called after the document has loaded in its entirety
// This guarantees that any elements we bind to will exist on the page
// when we try to bind to them
// See: http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
Person = function(attribute){
this.attributes = attributes
}
@bootcoder
bootcoder / application.js
Created April 14, 2015 16:52
more stubbed js
$(document).ready(function() {
// This is called after the document has loaded in its entirety
// This guarantees that any elements we bind to will exist on the page
// when we try to bind to them
// See: http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
Person = function(attribute){
this.attributes = attributes
}