Skip to content

Instantly share code, notes, and snippets.

@bholtbholt
bholtbholt / nested-stores.js
Created February 6, 2022 20:25
How to handle accessing nested data in Svelte stores using curried functions
// $list has a nested structure like:
// lists: [
// {
// "id": "TODO-ns88qrJDVXizlF0l",
// …properties omitted for brevity
// "cards": [
// {
// "id": "6OPzS6B6WoBT0J_EGqUEy",
// "listId": "TODO-ns88qrJDVXizlF0l",
// …properties omitted for brevity
@abilogos
abilogos / detect-zoom.js
Created November 24, 2019 20:24
Getting browser Zoom level
//for zoom detection
px_ratio = window.devicePixelRatio || window.screen.availWidth / document.documentElement.clientWidth;
$(window).resize(function(){isZooming();});
function isZooming(){
var newPx_ratio = window.devicePixelRatio || window.screen.availWidth / document.documentElement.clientWidth;
if(newPx_ratio != px_ratio){
px_ratio = newPx_ratio;
console.log("zooming");