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
<template> | |
<div class="text__container"> | |
<label for="text">put text:</label> | |
<textarea | |
id="" | |
v-model="text" | |
name="texts" | |
cols="30" | |
rows="10" | |
style="border: 1px solid black" |
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
import React, { useEffect } from 'react'; | |
import { useImmer } from 'use-immer'; | |
export default function Input() { | |
const [state, setState] = useImmer({ | |
name: '', | |
}); | |
const handleNameChange = (e) => { | |
setState((draft) => { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
<style> | |
.block { | |
position: relative; |
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
// Debounce input event on vanilla js | |
// let debounceTimer; | |
// function handleInput(e) { | |
// window.clearTimeout(debounceTimer); | |
// debounceTimer = window.setTimeout(() => console.log(e.target.value), 1000); | |
// } | |
// document.querySelector('#input').addEventListener('input', handleInput); | |
// Use higher-order debounce function to debounce an event listener |
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
/** | |
* | |
* @param {} obj object to filter | |
* @param {...any} allowedKeys proporties to keep | |
* @returns object with only allowed keys | |
*/ | |
const filterObj = (obj, ...allowedKeys) => { | |
const newObj = {}; | |
Object.keys(obj).forEach((key) => { | |
if (allowedKeys.includes(key)) { |
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
{ | |
"name": "myproject", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"switch": "shopify switch --store <storeUrl>", | |
"dev": "npm-run-all --parallel serve convert-sass", | |
"serve": "shopify theme dev <storeUrl> --live-reload hot-reload --theme-editor-sync", | |
"convert-sass": "sass --watch --no-source-map sass/:assets/" |
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
'use strict'; | |
const crypto = require('crypto'); | |
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters) | |
const IV_LENGTH = 16; // For AES, this is always 16 | |
function encrypt(text) { | |
let iv = crypto.randomBytes(IV_LENGTH); | |
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv); |
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
<body> | |
<div class="ui-settings"> | |
<div> | |
<label for="dark">Enable dark mode:</label> | |
<input type="checkbox" name="dark" id="dark-mode-checkbox" /> | |
</div> | |
</div> | |
<div class="ui-elements"> | |
<div class="w-20 h-20 bg-green-500 dark:bg-gray-500"></div> |