gaiety / randomAlphaNumeric.js
0 likes
0 forks
1 files
Last active 3 months ago
Great for simple dynamic items, like a dynamic html ID suffix
| 1 | # Returns random a-z0-9 pattern of 9 characters |
| 2 | # Example: qhp050kba |
| 3 | |
| 4 | function randomAlphaNumeric() { |
| 5 | return Math.random().toString(36).slice(2) |
| 6 | } |
gaiety / date-time-bash.sh
0 likes
0 forks
1 files
Last active 3 months ago
Simple variables for the current date and time, great to include in logs for small scripts
| 1 | currentDate=$(date +"%m_%d_%Y") |
| 2 | currentTime=$(date +"%T") |
| 3 | |
| 4 | echo "Hello! It is $currentTime on the $currentDate" >> my-log.log |
gaiety / userIsTypingStuff.js
0 likes
0 forks
1 files
Last active 3 months ago
Hack for JavaScript check to see if the user might be typing somewhere
| 1 | let userIsTypingStuff = document.querySelectorAll('input:focus, textarea:focus').length !== 0; |
| 1 | toWords :: String -> [String] |
| 2 | toWords x |
| 3 | | length x == 0 = [] |
| 4 | | otherwise = takeWhile (/= ' ') x : toWords (drop 1 (dropWhile (/= ' ') x)) |