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
#Define a function calledget_class_average that has one argumentstudents. You can expect students to be a list containing your three students. | |
#First, make an empty list calledresults. | |
#For each student item in the classlist, calculate get_average(student) and then call results.append() with that result. | |
#Finally, return the result of callingaverage() with results. | |
def get_class_average(students): | |
results = {} //should be results = [] | |
for item in students: | |
results.append(get_average(item)) | |
return average(results) |
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 reverse_string(list): | |
list_length = len(list) | |
for i in range(0, list_length//2, 1): | |
temp_letter = list[i] | |
list[i] = list[list_length - i - 1] | |
list[list_length - i - 1] = temp_letter | |
return list |
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
<html> | |
<body> | |
<script> | |
/* this function will be accessible through global scope, which is a bad practice | |
meaning you will be able to call it through window.bla() */ | |
function bla() { | |
console.log('bla function'); | |
} | |
</script> |
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
authors: | |
hanzou: | |
name: Hanzou Hattori | |
display_name: Hanzou | |
gravatar: c66919cb194f96c696c1da0c47354a6a | |
email: hanzou@company.com | |
web: http://company.com | |
twitter: company | |
github: hhattori | |
jorgen: |
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
//bug: in the following case 1d 00h 00m 25s it would not show "00m" since it only checks previous time component | |
var x = moment() | |
.add(1, 'month') | |
.add(1, 'day') | |
.add(1, 'hour') | |
.add(1, 'minute') | |
.add(10, 'seconds'); | |
function format(duration) { |
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
function getRandomBetween(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
var apiKey = 'apikey=ed23113a7ebab2304b0aad655ec41c6a'; | |
var totalCharacters = 1485; | |
var randomOffset = getRandomBetween(1, totalCharacters); | |
//var randomOffset = 1341; | |
$.get('http://gateway.marvel.com:80/v1/public/characters?limit=1&offset=' + randomOffset + '&' + apiKey) |
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
function getRandomBetween(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
var apiKey = 'apikey=ed23113a7ebab2304b0aad655ec41c6a'; | |
var totalCharacters = 1485; | |
var randomOffset = getRandomBetween(1, totalCharacters); | |
//var randomOffset = 1341; | |
var idsOfCharsWithoutImage = []; | |
var imageNotAvailable = 'image_not_available'; |
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
//http://gateway.marvel.com/v1/public/characters?limit=1&offset=1475&apikey=<your-api-key> | |
//at the time of Jun 20th 2015 512/1485 characters are without image (34.5%) | |
var idsOfCharactersWithoutImage = | |
[1010699, 1016823, 1011266, 1011031, 1011198, 1011175, 1011136, 1011170, 1009240, 1009497, 1011164, 1009567, 1011120, 1011194, 1010672, 1011214, 1011382, 1010673, 1016824, 1009153, 1011324, 1009151, 1009346, 1010905, 1011208, 1011253, 1010686, 1011275, 1010827, 1009161, 1010835, 1009162, 1010336, 1015239, 1011766, 1010718, 1017438, 1011137, 1011354, 1009550, 1009176, 1009177, 1009179, 1011262, 1009183, 1010859, 1011296, 1011224, 1009189, 1010881, 1010356, 1009198, 1009201, 1011073, 1010850, 1009204, 1011339, 1011264, 1010688, 1009205, 1011090, 1014973, 1009167, 1009210, 1010887, 1009213, 1011209, 1011190, 1011196, 1011096, 1011355, 1010143, 1009688, 1011258, 1009261, 1009344, 1009536, 1011141, 1009733, 1011331, 1009238, 1011187, 1014999, 1010809, 1011286, 1010798, 1010917, 1009246, 1009237, 1009250, 1011169, |
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
activate() { | |
//read model for application header | |
var appModel = this.modelFor(`application`); | |
//get current header that is rendered before we enter current route | |
var currentHeader = appModel.get(`currentHeader`); | |
//save that header to our current route | |
this.set(`prevHeader`) = currentHeader; | |
//set current app header to one that is defined in current route | |
appModel.set(‘currentHeader’) = this.get(`header`); | |
OlderNewer