This file contains hidden or 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 Promise = require('bluebird') | |
const _ = require('lodash') | |
// Include your dynogels models | |
let models = require('./routes/helpers/models') | |
// Include your mongoose models | |
let mongooseModels = require('./routes/helpers/mongooseModels') | |
module.exports = (settings, itemsMapping) => { |
This file contains hidden or 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
let dataSet = [{ | |
"survey_answers": [ | |
{ | |
"id": "9ca01568e8dbb247", // As they are, this is the key to groupBy | |
"option_answer": 5, // Represent the index of the choosen option | |
"type": "OPINION_SCALE" // Opinion scales are 0-10 (meaning elleven options) | |
}, | |
{ | |
"id": "ba37125ec32b2a99", | |
"option_answer": 3, |
This file contains hidden or 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
list_of_numbers = [1, 2 , 1, 3] | |
def find_count_of_lowest(numbers): | |
numbers.sort() | |
lowest_number = numbers[0] | |
count_lowest_number = 0 | |
for number in numbers: | |
if number == lowest_number: |
This file contains hidden or 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
# Numbers between | |
def numbers_between(numbers, min_range, max_range): | |
# Create empty list to contain our results | |
result = [] | |
# Run through each number | |
for number in numbers: | |
# If number is bigger or equal to min_range and bigger or equal to max_range | |
if number >= min_range and number <= max_range: |
This file contains hidden or 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 'intersection-observer'; | |
import scrollama from 'scrollama'; | |
const scroller = scrollama(); | |
// setup the instance, pass callback functions | |
scroller | |
.setup({ | |
step: settings.$refs.slide__item, |
This file contains hidden or 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
# First we def (define) a function that takes 2 arguments: | |
# 1. argument is the text to look for occurances | |
# 2. argument is the word_to_count | |
def count_word_in_text(text, word_to_count): | |
# The count of our word that we're counting | |
count = 0 | |
# The text index looking from | |
start = 0 |
This file contains hidden or 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
# We need to count the occurance of words in a text | |
def count_word_in_text(text, word_to_count_by): | |
# We first have the text and then we run a "count" method on the text | |
# then we parse the word_to_count_by | |
return text.count(word_to_count_by) | |
# Now we add a string of text we want to count the occurances of a certain word in | |
# Secound paramater is the word we want to count | |
count_of_words = count_word_in_text("Hello world, its a great day in this world", "world") |
This file contains hidden or 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
# So first we def (define) the function and giving it | |
# the name increment, and adding one parameter | |
# i call that number_to_increment because its | |
# the number that you want to increment by 1 | |
def increment(number_to_increment): | |
# Then we return the number_to_increment + 1 | |
# So if the number_to_increment is 3 it will return 4, if number_to_increment is 500 it will return 501 | |
return number_to_increment + 1 | |
# Here we test the function works |
This file contains hidden or 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() { | |
'use strict'; | |
angular | |
.module('factory.Excel', []) | |
.factory('Excel', Excel); | |
function Excel($document, $window) { | |
return { | |
create: create |
This file contains hidden or 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() { | |
'use strict'; | |
var modules = []; | |
angular | |
.module('directive.whenScrolled', modules) | |
.directive('whenScrolled', whenScrolled); | |
function whenScrolled() { |