Skip to content

Instantly share code, notes, and snippets.

Avatar

Tobias Reich electerious

View GitHub Profile
@electerious
electerious / ackee_scriptable_views_today.js
Last active March 17, 2021 18:32
Ackee iOS widget for Scriptable.app
View ackee_scriptable_views_today.js
// On first run only, uncomment line bellow and replace '888...' with the token returned after login
// Keychain.set("ACKEE_KEY", "88888888-8888-8888-8888-888888888888")
// Ackee configuration
const ACKEE_KEY = Keychain.get('ACKEE_KEY')
const ACKEE_API = 'https://ackee.example.com/api'
const TIME_ZONE = 'Europe/Berlin'
const createWidget = async () => {
const viewsToday = await getViewsToday()
View .eslintrc.json
{
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"react"
View throttle.js
const throttle = (fn, threshold) => {
let last
let timeout
return (...args) => {
const now = Date.now()
const shouldDelay = last && now < last + threshold
const delay = shouldDelay === true ? threshold - (now - last) : 0
@electerious
electerious / absoluteToRelativePath.js
Created November 4, 2018 12:50
Converts absolute SVG coordinates to relative ones in order to create a responsive SVG mask that can be applied using CSS clip-path
View absoluteToRelativePath.js
"M78,0 L78.8918331,0.216238031 C80.7796201,0.673959707 82.3332983,2.08608489 83.0043945,3.9000001 C83.0192652,3.94019419 83.0330484,3.98600042 83.0457442,4.03741878 L83.0390876,7.96097867 C83.0390545,20.7025492 93.3365052,31 106.039054,31 L268.960946,31 C281.663495,31 291.960946,20.7025492 291.960946,8 C291.960946,7.99147462 291.95879,6.71458263 291.954479,4.16932405 C291.954323,4.07746778 291.970341,3.98630146 292.001801,3.9000001 C292.667785,2.07301174 294.211271,0.676168263 296.108167,0.216238031 L297,0 L335,0 C357.09139,-4.05812251e-15 375,17.90861 375,40 L375,772 C375,794.09139 357.09139,812 335,812 L40,812 C17.90861,812 2.705415e-15,794.09139 0,772 L0,40 C-2.705415e-15,17.90861 17.90861,4.05812251e-15 40,0 L78,0 Z"
.split(' ')
.reduce((acc, entry) => {
// Remove the first character from a string
const removeChars = (str = '') => str.replace(/^[A-Z]/g,'')
// Divide a value with the current divider
const divide = (dividers) => (value, index) => value / dividers[index]
View familyname.html
<label for="familyname">Family name</label>
<input id="familyname" name="familyname" type="text" autocorrect="off" autocomplete="family-name" placeholder="Berners-Lee">
View disabled.html
<select disabled>
<option value="a">A</option>
<option value="b">B</option>
</select>
<select>
<option disabled>Choose A or B</option>
<option value="a">A</option>
<option value="b">B</option>
</select>
View placeholder.html
<input placeholder="Jane Doe" ...>
View label.html
<label for="email">E-Mail</label>
<input id="email" ...>
View type.html
<input pattern="\d*" ...>
<input type="email" ...>
<input type="url" ...>