This file contains hidden or 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 express = require('express'); | |
| const app = express(); | |
| // Application | |
| app.get('/', function(req, res) { | |
| if (process.env.NODE_ENV === 'development') { | |
| for (var key in require.cache) { | |
| delete require.cache[key]; | |
| } | |
| } |
This file contains hidden or 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 from 'react' | |
| import { Box, useElementQuery } from 'atomic-layout' | |
| // Initially, I thought of EQ as a standalone query-value binding | |
| // with the React component being an application surface. | |
| // The problem with this is that the props assignment becomes abstracted, | |
| // and it's not easy to scan which props are assigned to a component, | |
| // and which comes from the EQ declared eslewhere. | |
| const InitialIdea = () => { | |
| const styles = useElementQuery( |
This file contains hidden or 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
| function throttle(func, timeout) { | |
| let wait = false; | |
| return function (...args) { | |
| if (!wait) { | |
| func(...args) | |
| wait = true; | |
| setTimeout(function () { | |
| wait = false; |
This file contains hidden or 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
| // Adding this event listener prints the message | |
| // into browser's console whenever the window | |
| // is resized (emits the "resize" event). | |
| // | |
| // Note that the "resize" event occurs for each | |
| // pixel that the browser being resized. | |
| window.addEventListener('resize', function () { | |
| console.log('Resize happened!') | |
| }) |
This file contains hidden or 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
| function debounce(func, duration) { | |
| let timeout | |
| return (...args) => { | |
| const effect = () => { | |
| timeout = null | |
| return func(...args) | |
| } | |
| clearTimeout(timeout) |
This file contains hidden or 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 { | |
| -webkit-perspective: 1000px; | |
| } | |
| #style-text { | |
| -webkit-transform: translateX(98.5%) rotateY(-10deg); | |
| -webkit-transform-origin: right; | |
| max-height: 94.5%; | |
| } |
This file contains hidden or 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
| expect(myFunc(['a', 'b']).toEqual(2) |
This file contains hidden or 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 getUser = (id: string) => User | |
| const getPosts = (user: User) => Post[] | |
| const getTotalLikes = (posts: Post[]) => number | |
| // getUser -> getPosts -> getTotalLikes |
This file contains hidden or 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
| function myFunc(list: number[]): string {} |