This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @use 'sass:math'; | |
| $base-font-size = 16px | |
| @function stripUnit($value) { | |
| @return $value / ($value * 0 + 1); | |
| } | |
| @function rem($pxValue) { | |
| @return #{math.div(stripUnit($pxValue), stripUnit($base-font-size)}rem; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useRef } from 'react' | |
| export const useOutsideClick = (callback: () => void) => { | |
| const ref = useRef<HTMLDivElement>(null) | |
| useEffect(() => { | |
| const handleClickOutside = (event: MouseEvent) => { | |
| if (ref.current && !ref.current.contains(event.target as Node)) { | |
| callback() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface InterfaceGenericSort<T> { | |
| property: Extract<keyof T, string | number | Date> | |
| isDescending: boolean | |
| } | |
| export function genericSort<T>(objectA: T, objectB: T, sorter: InterfaceGenericSort<T>) { | |
| const result = () => { | |
| if (objectA[sorter.property] > objectB[sorter.property]) { | |
| return 1 | |
| } else if (objectA[sorter.property] < objectB[sorter.property]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function genericFilterSearch<T>(object: T, properties: Array<keyof T>, query: string): boolean { | |
| if (query === '') { | |
| return true | |
| } | |
| return properties.some((property) => { | |
| const value = object[property] | |
| if (typeof value === 'string' || typeof value === 'number') { | |
| return value.toString().toLowerCase().includes(query.toLowerCase()) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function isValidEmail(email: string, acceptedDomains?: string[]) { | |
| const emailformat = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i | |
| let isValid = false | |
| if (email.match(emailformat)) { | |
| isValid = true | |
| if (acceptedDomains !== undefined) { | |
| isValid = acceptedDomains.some(function(domain) { | |
| return email.endsWith(domain) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Curly Braces": { | |
| "prefix": "cb", | |
| "body": [ | |
| "{$1}" | |
| ], | |
| "description": "curly braces" | |
| }, | |
| "Brackets": { | |
| "prefix": "bb", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function findNode(object, id) { | |
| const foundObj = object.filter(p => p.id === id) | |
| if (foundObj.length > 0) { | |
| return {...foundObj}; | |
| } else { | |
| const oc = object.filter(p => p.hasOwnProperty('subnodes')) | |
| if (oc && typeof oc === 'object' && oc !== null) { | |
| for (var i=0; i < oc.length; i++) { | |
| const retObj = findNode(oc[i].subnodes, id) | |
| if (retObj != null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AddSetViewController: UIViewController { | |
| @IBOutlet weak var RepsPickerView: UIPickerView! | |
| var rotationAngle: CGFloat! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| rotationAngle = -90 * (.pi / 180) | |
| let y = RepsPickerView.frame.origin.y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for i in *.png; do sips -s format jpeg -s formatOptions 100 "${i}" --out "${i%png}jpg"; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "bridge": { | |
| "name": "Homebridge", | |
| "username": "CC:22:3D:E3:CE:30", | |
| "port": 51826, | |
| "pin": "031-45-154" | |
| }, | |
| "platforms": [{ | |
| "platform": "Telldus", |
NewerOlder