Skip to content

Instantly share code, notes, and snippets.

View artystable's full-sized avatar
🔍
Probably learning something new.

Arty Stable artystable

🔍
Probably learning something new.
View GitHub Profile
@artystable
artystable / azavea-arty-demo.html
Created July 30, 2019 20:00
A small demo to satisfy the Azavea assessment process. This is a refactored 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.
<!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">
@artystable
artystable / azavea-arty-demo.js
Created July 30, 2019 20:16
A small demo to satisfy the Azavea assessment process. This is a refactored 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.
/**
* 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];
@artystable
artystable / 200226-snippet-chrome-extension-names-get.js
Last active February 27, 2020 04:05
Get list of Chrome extension names.
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)
})
@artystable
artystable / random-date.js
Created April 7, 2020 20:37 — forked from miguelmota/randomDate.js
Random date in JavaScript
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()));
@artystable
artystable / merge.js
Created April 18, 2020 01:32
Very rudimentary script to merge to JS object arrays.
let one = [
{
id: "aBcDeFgH",
firstName: "Juan",
lastName: "Doe",
age: 32,
},
{
id: "zYxWvUt",
@artystable
artystable / regform-notemplate.php
Created September 23, 2020 02:39 — forked from mhawksey/regform-notemplate.php
Embedding and customising a Google Form (with dynamic parallel session selection)
<?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);
@artystable
artystable / hotkey_helpers.js
Created December 15, 2020 14:22 — forked from jiaaro/hotkey_helpers.js
Mac Automation – Javascript (JSX) Hotkey helpers
// 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");
@artystable
artystable / stars.sh
Created December 18, 2020 10:40 — forked from sebble/stars.sh
List all starred repositories of a GitHub user.
#!/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
@artystable
artystable / hotkeys.js
Created December 25, 2020 05:59 — forked from abuduba/hotkeys.js
Hotkey library
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],