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 getRandomInt(min, max) { | |
| min = Math.ceil(min); | |
| max = Math.floor(max); | |
| return Math.floor(Math.random() * (max - min)) + min; | |
| } | |
| function newRandomPort() { | |
| document.getElementById("randomport").textContent = "" + getRandomInt(1024, 65534) | |
| } |
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 React from 'react'; | |
| const useAudio = (initialSrc = null) => { | |
| const [src, setSrc] = React.useState(initialSrc); | |
| const [isPlaying, setIsPlaying] = React.useState(false); | |
| const [progress, setProgress] = React.useState(0); | |
| let audio = React.useRef(new Audio()); | |
| React.useEffect(() => { | |
| let currentAudio = audio.current; |
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 {string, addMethod } from 'yup'; | |
| /** | |
| * string().isbn() | |
| * @param {String} message message to display when invalid. | |
| */ | |
| // eslint-disable-next-line no-template-curly-in-string | |
| addMethod(string, 'isbn', function (message = '${path} must be a valid ISBN') { | |
| const rISBN = /(?:(?=.{17}$)97[89][ -](?:[0-9]+[ -]){2}[0-9]+[ -][0-9]|97[89][0-9]{10}|(?=.{13}$)(?:[0-9]+[ -]){2}[0-9]+[ -][0-9Xx]|[0-9]{9}[0-9Xx])/; | |
| return this.matches(rISBN, { |
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
| const Iubenda = ({ | |
| policyId | |
| }) => { | |
| useEffect(() => { | |
| var s = document.createElement("script"); | |
| let tag = document.getElementsByTagName("script")[0]; | |
| s.src="https://cdn.iubenda.com/iubenda.js"; | |
| tag.parentNode.insertBefore(s,tag); |
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
| { | |
| "xmlMode": true, | |
| "lowerCaseAttributeNames": false | |
| } |
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 getSopMonth (asText = false) { | |
| let date = new Date(); | |
| let month = date.getUTCMonth() + 1; // date.getMonth() is zero indexed. | |
| let names = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; | |
| if (asText) { | |
| return names[month]; | |
| } | |
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
| tell application "iTerm" | |
| tell current session of current window | |
| set btm to (split horizontally with default profile) | |
| tell btm | |
| split vertically with default profile | |
| end tell | |
| end tell | |
| end tell |
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
| data = {}; | |
| $('section.tab-content').each((i, el) => { | |
| let section_data = []; | |
| let title = $(el).find('h2'); | |
| let h3s = $(el).find('h3'); | |
| let rows = $(el).find('.row-default'); | |
| console.log(title.text()); | |
| h3s.each((i, h3el) => { |
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
| #!/bin/bash | |
| rsync --progress --ignore-existing -avzu --exclude=".*/" "/Users/cwardzala/Music/iTunes/iTunes Media/Music" "/Volumes/Shared Media/" |
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
| #!/usr/bin/env python | |
| import re | |
| import json | |
| def slugify(title): | |
| title = title.lower() | |
| empties = re.compile('[-\\s]+') | |
| title = empties.sub('-', title) | |
| odds = re.compile('[^\w\s-]') |
NewerOlder