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
| //Call the function on scroll | |
| $(window).scroll(numberCounter); | |
| //Check if in viewport function | |
| function inViewport(el, val) { | |
| var docViewTop = $(window).scrollTop(); | |
| var docViewBottom = docViewTop + $(window).height(); | |
| var elTop = $(el).offset().top; | |
| var elBottom = elTop + $(el).height(); |
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
| Vue.filter('videoUrl', function (url) { | |
| //youtube | |
| if (url.includes('youtube') || url.includes('youtu.be')) { | |
| //Get id | |
| url = url.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); | |
| let id = (url[2] !== undefined) ? url[2].split(/[^0-9a-z_\-]/i)[0] : url[0]; | |
| return 'https://www.youtube.com/embed/' + id | |
| } else if (url.includes('vimeo')) { | |
| var url = url.match(/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?/i); | |
| return 'https://player.vimeo.com/video/' + url[1] |
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 re | |
| # Vimeo | |
| vimeo_url = 'https://vimeo.com/56282283' | |
| # Regex to strip id from video string | |
| match_pattern = r'^(?:https?:)?(?:\/\/)?(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)' | |
| response = re.search(match_pattern, url).group(3) | |
| if response: | |
| print (response) |
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
| $(document).ready(function () { | |
| var creditCardField = $('#card-element'); | |
| creditCardField.on('keyup', function () { | |
| //Turn card number into string for substring method | |
| var creditCardString = creditCardField.val().toString(); | |
| if (creditCardString.length < 2) { | |
| //Hide all cards |
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
| def sort(nums): | |
| for i in range(len(nums) - 1, 0, -1): | |
| for j in range(i): | |
| if nums[j] > nums[j + 1]: | |
| temp = nums[j] | |
| nums[j] = nums[j + 1] | |
| nums[j + 1] = temp | |
| nums = [5, 3, 8, 6, 7, 2] |
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
| def selectSort(nums): | |
| for i in range(5): | |
| minpos = i | |
| for j in range(i, 6): | |
| if nums[j] < nums[minpos]: | |
| minpos = j | |
| temp = nums[i] #hold old value | |
| nums[i] = nums[minpos] #put new min value where old one was | |
| nums[minpos] = temp #put old value where min used to be |
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
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); |
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 isVisible (ele) { | |
| const { top, bottom } = ele.getBoundingClientRect(); | |
| const vHeight = (window.innerHeight || document.documentElement.clientHeight); | |
| return ( | |
| (top > 0 || bottom > 0) && | |
| top < vHeight | |
| ); | |
| } |
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
| library(dplyr) | |
| library(tidytext) | |
| library(ggplot2) | |
| data <- read.csv('/Users/steven/Desktop/JEOPARDY_CSV.csv') | |
| text_set <- iconv(data$Question, to = "utf-8-mac") | |
| clean_text <- text_set %>% | |
| as_tibble() %>% | |
| unnest_tokens(word, value, to_lower = TRUE, strip_punct = TRUE, strip_numeric = TRUE) %>% |
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
| /* ============================================ | |
| Inset helper for quick top, right, bottom, left properties. | |
| Use until the inset: css property has better browser support | |
| https://caniuse.com/mdn-css_properties_inset | |
| */ | |
| @mixin inset($top: 0, $right: 0, $bottom: 0, $left: 0) { | |
| top: $top; | |
| right: $right; | |
| bottom: $bottom; |
OlderNewer