Archive of category "JavaScript"

Always cancel promises started in React.useEffect
If you start a promise inside useEffect, make sure to cancel it in the cleanup handler.
December 11, 2021

How to fix "No bundle URL present" and change the packager port in React Native
TLDR: set port in Metro options, and set RCT_METRO_PORT in React-Core preprocessor definitions. But wait! There's more.
August 9, 2021

Reselect memoization explained
Reselect does a good job of optimizing with referential transparency, but does nothing for referential stability.
June 13, 2021

Migrating a 20K SLOC production project to TypeScript
I've migrated Sintra from JavaScript to TypeScript. It took me a couple of weekends to finish. I'm incredibly happy with the result.
March 28, 2021

How to shim legacy dependencies in Webpack (like jQuery)
You don't need to make it complicated.
February 16, 2021

Things I've learned from writing React apps
Some accumulated practical wisdom.
February 26, 2019

I made a React hook to get the current date
A real life example of using hooks to solve a problem.
February 24, 2019

The JavaScript that I like
I'm not going to criticize or evangelize JavaScript here. Let's unwrap "my" JavaScript assumptions one at a time.
April 18, 2018

How to log errors coming from React components
And make use of propType validation.
December 24, 2015

Demystifying direct uploads from the browser to Amazon S3 - with a full example in 167 lines of code
November 11, 2015

The genius of React
React makes it possible to code modern web application with the same simple approach as traditional, non-interactive websites.
August 30, 2015

How to index mixed-language content with Lunr.js
August 9, 2015, revised April 11, 2017

A formal prover for certain programs in the Javascript programming language
This thesis is concerned with developing an automatic system for sound formal proofs of programs written in a certain imperative subset of Javascript with logical annotations.
July 6, 2015

Be so kind and warn users before navigating from an unsaved form
I lost the text of the article I was just writing because I accidentally hit the Chrome shortcut for “Back” – Cmd+[ – it’s the same key that un-indents text in Sublime Text. So now I’m writing this new article after fixing my form.
March 2, 2014

Подтасовка шаблонов: новый способ расширения веб-приложений
На днях мне захотелось всунуть в задачи Pivotal Tracker'а кнопочку, которая перекидывала бы задачи в OmniFocus. Кнопочку я таки всунул, а теперь расскажу, как.
April 22, 2012

Как перехватывать клик по Flash-баннеру
Разместить флешку на сайте – дело несложное. Однако, в 95% случаев ожидается, что флешка будет ссылкой. Думаешь, объект Flash можно просто положить в "a"? Нельзя. Приходится ограничиваться внутренними средствами.
February 9, 2011, revised February 10, 2011

Отладка скриптов в Internet Explorer
Создаем и настраиваем виртуальную машину для отладки HTML и JavaScript в Internet Explorer
May 27, 2010, revised January 10, 2011

Область видимости переменной в Javascript (variable scope) - ликбез
В Javascript области видимости усложнены тем, что функции могут определяться внутри других функций, а вызываться где угодно. оп
December 22, 2009, revised March 21, 2011

Javascript: Подсказки внутри INPUT
Постановка задачи: нужно, чтобы в пустом input выводился приглушенным цветом какой-то текст, например, подсказка.
February 16, 2008, revised June 17, 2011

Растягивание TEXTAREA по вертикали
Решил опубликовать пару скриптов, написанных для
February 15, 2008, revised March 2, 2014