Skip to content

Instantly share code, notes, and snippets.

View RaddishIoW's full-sized avatar

Adam Radestock RaddishIoW

View GitHub Profile
@RaddishIoW
RaddishIoW / increment_build_numbers.js
Created August 5, 2020 12:21
Cordova Hook for updating the build number for iOS and android, using https://github.com/prantlf/build-number-generator to create the build number. Compatible with iOS and android build numbering and semver versioning.
#!/usr/bin/env node
// Based on:
// https://gist.github.com/ohh2ahh/f35ff6e0d9f8b4268cdb
// Save hook in your cordova root in eg `<project-root>/scripts/`
// Add the hook to your cordova config.xml eg
// <hook type="before_prepare" src="scripts/increment_build_numbers.js"/>
//
// Don't forget to install xml2js and build-number-generator using npm or yarn
@RaddishIoW
RaddishIoW / RelativeTime.jsx
Last active April 1, 2023 00:01
A React Hooks-based component using Luxon to format a date to a relative string representation, updating that string once a minute.
import React from 'react'
import PropTypes from 'prop-types'
import { DateTime } from 'luxon'
const RelativeTime = (props) => {
const dt = DateTime.fromJSDate(props.time)
const [relTime, setRelTime] = useState(dt.toRelative())
const [intervalID, setIntervalID] = useState()
useEffect(() => {