Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.
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 main(): | |
| global target_url | |
| global HTML_string | |
| global driver | |
| relative_anchors = findAllAnchors(target_url) | |
| # Iterate the relative anchors and collect data | |
| for anchor in relative_anchors: | |
| anchorHref = str(anchor['href']) |
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 visitPage(url, relativeUrl): | |
| global driver | |
| global HTML_string | |
| # Visit the page | |
| driver.get(url+relativeUrl) | |
| # Turn on staging and debug (Optional) | |
| # driver.execute_script(stagingScript) | |
| # driver.execute_script(debugScript) |
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 findAllAnchors(url): | |
| # Use requests to get page source without using driver | |
| r = requests.get(url) | |
| # Turn the page source into soup for parsing | |
| soup = bs4(r.text, "html5lib") | |
| # Return a Set of relative anchors tags from a given | |
| return set([anchor for anchor in soup.find_all('a', href=True) if anchor['href'].startswith('/') and not anchor['href'].endswith(('.com', '.org', '.net'))]) |
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
| from selenium import webdriver | |
| from selenium.webdriver.chrome.options import Options | |
| from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
| import os | |
| def chromeDriver(): | |
| if os.path.exists('.env'): | |
| for line in open('.env'): | |
| var = line.strip().split('=') | |
| if len(var) == 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
| function countCSSRules() { | |
| var results = '', | |
| log = ''; | |
| if (!document.styleSheets) { | |
| return; | |
| } | |
| for (var i = 0; i < document.styleSheets.length; i++) { | |
| countSheet(document.styleSheets[i]); | |
| } | |
| function countSheet(sheet) { |
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
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteRule ^index\.php$ - [L] | |
| RewriteRule (.*) ./index.php?id=$1 [L] | |
| </IfModule> |
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
| <!doctype html> | |
| <!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ --> | |
| <html> | |
| <head> | |
| <title>iOS 8 web app</title> | |
| <!-- CONFIGURATION --> |
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
| #macro(VelListToJSON $list ) | |
| #set($myList = $list )## dereference | |
| { | |
| #foreach($key in $myList.keySet()) | |
| "$key": | |
| #set($x = $myList.get($key)) | |
| #VelToJSON($x) | |
| #if($foreachCount != $myList.keySet().size()) , #end | |
| #end | |
| } |
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
| preferred_syntax = :sass | |
| http_path = '/' | |
| css_dir = 'assets/stylesheets' | |
| sass_dir = 'assets/sass' | |
| images_dir = 'assets/images' | |
| javascripts_dir = 'assets/javascripts' | |
| relative_assets = true | |
| line_comments = true | |
| # output_style = :compressed |
NewerOlder