browser-sync start --proxy "localhost:3000" --files --ws --tunnel --logLevel="debug" "bundle/*.css, bundle/*.js"
This file contains 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
// Debug HTML5 Video or Audio events | |
// Assign multiple events | |
let media = document.getElementById('somevideo') | |
'canplay canplaythrough durationchange emptied error loadstart loadedmetadata playing pause seeked suspend stalled timeupdate volumechange waiting'.split(' ').forEach(e => { | |
media.addEventListener(e, event => { | |
console.log('Event fired') | |
console.log(event.type) |
I hereby claim:
- I am gkweb on github.
- I am gkweb (https://keybase.io/gkweb) on keybase.
- I have a public key ASCh-WAe_b1NJ0TbbJT70d-NXeTUaigECK1QFadW_NZ6zwo
To claim this, I am signing this object:
This file contains 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
// DEMO: https://codepen.io/gkweb/pen/QWEeBeV | |
.todo { | |
opacity: 0.25; | |
padding: 2rem 1rem; | |
margin-bottom: 1rem; | |
background: repeating-linear-gradient( | |
-45deg, | |
transparent, | |
transparent 5px, |
This file contains 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
// computed: | |
// Dynamic input ID - Useful for inputs / label pairs where there is no requirement to specify the ID | |
inputId() { | |
return Math.random().toString(36).substr(2, 5) | |
} | |
// Detect if slots available programmatically (no need for prop toggles!) | |
hasSlot() { | |
return this.$scopedSlots && typeof this.$scopedSlots.slotName === 'function' | |
} |
This file contains 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
// WARNING USE WITH CAUTION! This will delete any user in the search result!!! - You have been warned! | |
// Quicker than setting up the Management API with all its related tooling | |
// Step 1 - Search for the users you want to delete in /dashboard/COUNTRYCODE/TENANT/users | |
// Step 2 - Open the browser console and paste the following. Be sure to read the warning at the top of the file. | |
Array.prototype.slice.call(document.querySelectorAll('table[data-cosmos-key=table] > tbody > tr')).forEach(e => { | |
setTimeout(() => { | |
console.log('Deleting...') |
This file contains 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
/* | |
* author: @gkweb | |
* Add this as an inline style tag to the <head> | |
* | |
* Adjust for whatever media query structure you have | |
* Helps with CLS - The style is there immediately and this means you can set dimensions for every screensize | |
*/ | |
@media screen and (min-width: 480px) { | |
[data-sm-width] { |
This file contains 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
/** | |
* Liteweight matchMedia | |
* | |
* @param {String} query - The media query. | |
* @param {Function} - onChange callback. | |
*/ | |
const useMatchMedia = (query, onChange = matches => matches) => { | |
const mm = matchMedia(query) | |
// Safari still uses addListener | |
mm.addListener(mql => onChange(mql.matches)) |
This file contains 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 validateUrl = /(https?\:\/\/([\w\-]+)?.?pointhacks.com(.au)?)/gi | |
// In use | |
validateUrl.test('https://broken.com') | |
validateUrl.test('https://working.pointhacks.com.au') |
OlderNewer