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> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="description" content="A navbar component with auto-hide functionality. This component was refactored from a CodyHouse article/repo. Below is the link to the article."> | |
| <meta name="keywords" content="navbar, auto, auto-hide, auto hide, hide, navigation, html, html5, css, css3, javascript"> | |
| <meta name="author" content="Arty Stable"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <link href="https://fonts.googleapis.com/css?family=David+Libre|Hind:400,700" rel="stylesheet"> |
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
| /** | |
| * Script Functional Goal: I want to refactor a navbar web component with auto-hide functionality without using jQuery for better mobile user experience without the need to sacrifice resource loading costs from using jQuery. | |
| **/ | |
| // Run when HTML5 doc is loaded. | |
| document.addEventListener('DOMContentLoaded', function(){ | |
| // Set main variables. | |
| var mainHeader = document.getElementsByClassName('cd-auto-hide-header')[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
| var extManCont = document.querySelector('extensions-manager') | |
| var extManContView = extManCont.shadowRoot.querySelector('#viewManager') | |
| var extManContViewItemsList = extManContView.querySelector('#items-list') | |
| var extCardList = extManContViewItemsList.shadowRoot.querySelectorAll('extensions-item') | |
| var extCardNameList = [] | |
| extCardList.forEach(function (card) { | |
| extCardNameList.push(card.shadowRoot.querySelector('#name').innerHTML) | |
| }) |
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 randomDate(start, end) { | |
| return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); | |
| } | |
| console.log(randomDate(new Date(2012, 0, 1), new Date())); |
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 one = [ | |
| { | |
| id: "aBcDeFgH", | |
| firstName: "Juan", | |
| lastName: "Doe", | |
| age: 32, | |
| }, | |
| { | |
| id: "zYxWvUt", |
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
| <?php | |
| $formKey = "blahblahblah"; // ENTER YOUR OWN VALUE - you can find your formkey by going to your live form in the spreadsheet and copying the value from the url | |
| $redirectUrl = "http://www.yoursite.com/thank-you/"; // ENTER YOUR OWN VALUE - the url you want to direct people to after they fill in the form | |
| $dataUrl = "https://spreadsheets0.google.com/spreadsheet/pub?blahblahblah&single=true&gid=1&output=csv"; // ENTER YOUR OWN VALUE - for parallel sessions you need to publish the public sheet via the share settings. This url is not published in the live webpage source | |
| // function to get external webpages/data | |
| function getData($url){ | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 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
| // How to use: | |
| // 1. Open "Script Editor" (requires OS X 10.10 Yosemite) | |
| // 2. Change the language from "AppleScript" to "JavaScript" | |
| // 3. Paste the code below and replace the safari example. | |
| // | |
| // More info: | |
| // https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html | |
| var sys_events = Application("System Events"); |
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
| #!/bin/bash | |
| USER=${1:-sebble} | |
| STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-) | |
| PAGES=$((658/100+1)) | |
| echo You have $STARS starred repositories. | |
| echo |
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 isEqual = (a, b) => { | |
| const aKeys = Object.keys(a); | |
| if (aKeys.length !== Object.keys(b).length) { | |
| return false; | |
| } | |
| return aKeys.every( | |
| (k) => Object.prototype.hasOwnProperty.call(b, k) | |
| && a[k] === b[k], |