Skip to content

Instantly share code, notes, and snippets.

View enwin's full-sized avatar

Thomas Beduneau enwin

View GitHub Profile
@enwin
enwin / input-type-mixin.scss
Created March 7, 2023 10:51
Detect current input used to interact with the website
@mixin interact() {
-webkit-tap-highlight-color: rgba(black, 0);
&:focus {
outline: none;
}
[data-input='mouse'] &:hover,
[data-input='keyboard'] &:focus,
[data-input='touch'] &:active {
@enwin
enwin / layouts.js
Last active January 7, 2023 00:56
Class to watch UI changes: width, height, scrollY, breakpoint based on the passed layout, page load, inputType
export default [
['small', `(min-width: ${576 / 16}rem)`],
['medium', `(min-width: ${768 / 16}rem)`],
['large', `(min-width: ${992 / 16}rem)`],
['xlarge', `(min-width: ${1200 / 16}rem)`],
['2xlarge', `(min-width: ${1400 / 16}rem)`],
]
@enwin
enwin / reactive-array-update.js
Created October 27, 2019 10:39
Update an array of objects while keeping it reactive for vue
export default (vueArray, data) => {
data.forEach((entry, index) => {
if (!vueArray[index]) {
vueArray.push(entry);
return;
}
const previousEntry = vueArray[index];
vueArray.splice(index, 1, {
@enwin
enwin / sticky-focus.js
Last active May 17, 2022 13:11
Detect and change the scroll position when a focused element is under a sticky element
// sticky element
var stickyHeader = document.querySelector( '.intro-banner' );
function handleFocus( e ){
// don't try to change the scroll if the focused element is in the sticky element
if( stickyHeader.contains( e.target )){
return;
}
// quick & dirty client height on each focus
@enwin
enwin / WSL_and_frond-end.md
Last active September 12, 2018 14:03
(WIP) Windows / WSL configuration to get a nice front-end setup

Keybase proof

I hereby claim:

  • I am enwin on github.
  • I am enwin (https://keybase.io/enwin) on keybase.
  • I have a public key whose fingerprint is 20BF 28A4 0747 EF59 3C2D 9ECE FFA3 980F 38BD 7A9D

To claim this, I am signing this object:

@enwin
enwin / replace emoji
Last active August 29, 2015 14:12
Replace Firefox OS emoji font
first backup you profile!!!
use [https://github.com/Mozilla-TWQA/B2G-flash-tool/blob/master/backup_restore_profile.sh] to do so.
then, create a backup of the default emoji font
```shell
adb pull /system/fonts/NotoColorEmoji.ttf
```
then rename your emoji font to NotoColorEmoji.ttf for convenience and run:
$('a').bind('touchstart touchend touchcancel click',function(e){
// prevent click on touch actions
e.preventDefault();
// stop script if touchstart, only execute the script on touchend (nicer)
e.type === touchstart && return
alert('here');
});