Skip to content

Instantly share code, notes, and snippets.

View glenndevenish's full-sized avatar

Max Reynolds glenndevenish

View GitHub Profile
@glenndevenish
glenndevenish / parseXeroReport.js
Created September 29, 2018 15:19
Parse Xero reports from their API into a nicer format
/*
As it stands, Xero reports from their API are not very nice to use. This function will return them in a flattened format.
This takes the Report data (so, `parseXeroReport(response.Reports)` where response is the raw response from the API), and parses it.
There's two formats it could take - one where it returns simply the value, and one where it returns an array of values.
{
"Date": "30 Sep 2018",
"Sales": "12345.67",
"Total Income": "12345.67",
@glenndevenish
glenndevenish / getPantoneData.js
Last active October 1, 2018 09:31
Gets RGB, HEX, and CMYK values from a Pantone
/*
How to use:
Go to pantone.com
open console
paste the below function
Run with getPantoneData('123 c').then(...)
It returns an object with the format:
@glenndevenish
glenndevenish / unleashedOldestBatches.js
Last active May 23, 2018 07:08
Automatically select oldest batches where option isn't available by default on Unleashed (unleashedsoftware.com)
async function selectBatches (pause) {
const wait = (ms) => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
$('.fa-plus-square').each(i => $('.fa-plus-square')[i].click())
await wait(pause)
$("a:contains('Select Oldest')").each(i => $("a:contains('Select Oldest')")[i].click())
await wait(pause)
@glenndevenish
glenndevenish / FormToCalendar.gs
Created February 19, 2018 10:01
Google Forms to Google Calendar integration
/*
From the Google Form, go to script editor. Enter this code.
You will need:
Calendar ID
Form ID
License:
Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
@glenndevenish
glenndevenish / search.js
Created February 14, 2018 14:29
Use an input with id of 'search' to filter array 'arr' - matches space-separated words
arr.filter(arr => arr.name.match(new RegExp($("#search").val().replace(/ /g, "|"), "i")))
@glenndevenish
glenndevenish / merge.js
Last active February 13, 2018 14:57
Merge duplicates in JSON array.
/*
merge.js
Merge duplicates in JSON array.
*/
old_array = [
{
"Some": "data",
"Here": "would",
"Be": "nice",
@glenndevenish
glenndevenish / pantone.js
Created January 3, 2018 17:29
returns javascript array from the pantone colour finder: https://www.pantone.com/color-finder/
// Todo: get document from array of pantones
// Load jQuery
(function () {
if ( !window.jQuery ) {
var dollarInUse = !!window.$;
var s = document.createElement('script');
s.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js');
s.addEventListener('load', function(){
console.log('jQuery loaded!');
@glenndevenish
glenndevenish / scroll.js
Last active November 17, 2017 17:12
Automatically scroll on a page (for getting lazy-loaded pages)
/*
Automatically scroll on a page (for getting lazy-loaded pages).
Run in the console.
UPDATE: Now shows percentage
*/
var scroll_units = 1000;
var scroll_iterations = 30;
var scroll_delay = 2000;
var iterations = 0;
@glenndevenish
glenndevenish / connect.js
Last active December 12, 2017 13:24
Automatically click 'connect' on every LinkedIn search result on the page.
/*
Automatically click 'connect' on every LinkedIn search result on the page.
Enter in the console, and click 'Send now' quickly on each one.
Requires jQuery, which is automatically loaded.
2.0 Features:
Selectively click on people with words in their profile (only works on the suggestions page)
Remove irrelevant suggestions from list
Reload page after clicking
*/
@glenndevenish
glenndevenish / keybase.md
Created October 27, 2017 15:21
Keybase Proof

Keybase proof

I hereby claim:

  • I am glenndevenish on github.
  • I am paniercas (https://keybase.io/paniercas) on keybase.
  • I have a public key whose fingerprint is F0E1 7FE2 4D6B EEC0 8B62 B4FA 81EB 77E8 2080 D6CD

To claim this, I am signing this object: