Skip to content

Instantly share code, notes, and snippets.

View James-Bovis's full-sized avatar
:octocat:

James Bovis James-Bovis

:octocat:
View GitHub Profile
@James-Bovis
James-Bovis / useStopwatch.ts
Created October 12, 2021 17:44
useStopwatch.ts
import * as React from 'react'
type UseStopwatch = {
seconds: number,
startStopwatch: () => void,
stopStopwatch: () => void,
resetStopwatch: () => void
}
const useStopwatch = (): UseStopwatch => {
@James-Bovis
James-Bovis / SassBlockComment.sublime-snippet
Created May 20, 2020 08:30
Sass comment Block Sublime Text snippet
<snippet>
<content><![CDATA[
////////////////////////////////////////////////////////////////////////////////
// ${1:Title}
////////////////////////////////////////////////////////////////////////////////
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>////</tabTrigger>
@James-Bovis
James-Bovis / generateRandomPlaceholder.js
Last active October 11, 2019 17:30
Random Placeholder Text from Array
const generateRandomPaceholder = (name: string): string => {
const placeholders = [
`For example, ${name} loves a good belly scratch and long walks at twilight on the beach.`,
`For example, ${name} is a legend and a great dog`,
`For example, ${name} is the best dog I could have ever wished for`,
`For example, ${name} makes me so happy my heart hurts`
]
const placeholderText = placeholders[Math.floor(Math.random() * placeholders.length)]
@James-Bovis
James-Bovis / ErbComponent.erb
Last active September 26, 2019 09:27
Using .webp images with correct fallback
<picture class="">
<source srcset="<%= asset_path('.../.../WEBP_ASSET.webp') %>" type="image/webp" />
<img src="<%= asset_path('../../FALLBACK_ASSET.jpg') %>" type="image/jpg" />
</picture>
@James-Bovis
James-Bovis / StickyFooter.html
Created September 12, 2019 18:42
Butternut Box - Sticky Footer
<div class="sticky-footer">
<a href="#" class="sticky-footer__item sticky-footer__item--active">
<img src="#" alt="Dashboard Icon">
Dashboard
</a>
<a href="#" class="sticky-footer__item">
<img src="#" alt="Dashboard Icon">
My Plan
</a>
<a href="#" class="sticky-footer__item">