Skip to content

Instantly share code, notes, and snippets.

Avatar
🧞‍♂️
Building awesome things

Josh Farrant joshfarrant

🧞‍♂️
Building awesome things
View GitHub Profile
@joshfarrant
joshfarrant / recursive.js
Created Apr 8, 2021
Code Kata Solutions - Persistent Bugger
View recursive.js
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 Apr 8, 2021
Code Kata Solutions - Sum of Positive
View 1-for-loop.js
const positiveSum = arr => {
let runningTotal = 0;
for (let i = 0; i < arr.length; i++) {
const value = arr[i];
if (value > 0) {
runningTotal += value;
}
}
View vendorlist.json
{
"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 Oct 4, 2018
Scriptable - Parse Forecast API data
View parse-forecast-data.js
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 = [
{
View keybase.md

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:

View dark.css
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
Puck.js example code
View puck.js
const UUIDS = {
INFO: 0x180A,
TEMPERATURE: 0x1809,
BATTERY: 0x180F,
};
const mainLoopTimeout = 60000;
const buttonPressTimeout = 5000;
const buttonInitialValue = 0;
const buttonValueIncrement = 10;