Skip to content

Instantly share code, notes, and snippets.

View joshfarrant's full-sized avatar

Josh Farrant joshfarrant

View GitHub Profile
@joshfarrant
joshfarrant / recursive.js
Created April 8, 2021 10:06
Code Kata Solutions - Persistent Bugger
const multiply = (a, b) => a * b;
const multiplyDigits = num => (
String(num).split('').reduce(multiply)
);
const persistence = (num, count = 0) => {
if (num < 10) {
return count;
}
@joshfarrant
joshfarrant / 1-for-loop.js
Last active April 8, 2021 13:19
Code Kata Solutions - Sum of Positive
const positiveSum = arr => {
let runningTotal = 0;
for (let i = 0; i < arr.length; i++) {
const value = arr[i];
if (value > 0) {
runningTotal += value;
}
}
{
"vendorListVersion": 215,
"lastUpdated": "2020-08-13T16:00:19Z",
"purposes": [
{
"id": 1,
"name": "Information storage and access",
"description": "The storage of information, or access to information that is already stored, on your device such as advertising identifiers, device identifiers, cookies, and similar technologies."
@joshfarrant
joshfarrant / parse-forecast-data.js
Last active October 4, 2018 14:35
Scriptable - Parse Forecast API data
const params = URLScheme.allParameters();
const baseUrl = params['x-success'];
const data = JSON.parse(params.data);
const maxInt = Number.MAX_SAFE_INTEGER;
// Rough precipitation descriptions
const precipDescriptions = [
{

Keybase proof

I hereby claim:

  • I am joshfarrant on github.
  • I am joshfarrant (https://keybase.io/joshfarrant) on keybase.
  • I have a public key ASCaugj-dlUP-O8mhbJ0So5Iu4QJ-_T65NADRZpVaN0ZDwo

To claim this, I am signing this object:

@joshfarrant
joshfarrant / dark.css
Last active September 6, 2017 12:20
Slack Theme
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@joshfarrant
joshfarrant / puck.js
Created May 8, 2017 08:14
Puck.js example code
const UUIDS = {
INFO: 0x180A,
TEMPERATURE: 0x1809,
BATTERY: 0x180F,
};
const mainLoopTimeout = 60000;
const buttonPressTimeout = 5000;
const buttonInitialValue = 0;
const buttonValueIncrement = 10;