Skip to content

Instantly share code, notes, and snippets.

View maullerz's full-sized avatar

Loginov Roman maullerz

View GitHub Profile
@iamakulov
iamakulov / index.md
Created July 21, 2022 17:03
Proxying api.my-app.com under my-app.com/api, using CloudFront or Cloudflare

Here’s how to make api.my-app.com available under my-app.com/api, using CloudFront or Cloudflare.

CloudFront

If both my-app.com and api.my-app.com are hosted in AWS, you can route requests to these instances using the CloudFront CDN.

Here’s what you’ll need to do:

  1. Create a CloudFront distribution
@hlubek
hlubek / nginx.conf
Created August 12, 2021 12:17
Nginx reverse proxy with caching for Next.js with imgproxy
# Based on https://steveholgado.com/nginx-for-nextjs/
# - /var/cache/nginx sets a directory to store the cached assets
# - levels=1:2 sets up a two‑level directory hierarchy as file access speed can be reduced when too many files are in a single directory
# - keys_zone=STATIC:10m defines a shared memory zone for cache keys named “STATIC” and with a size limit of 10MB (which should be more than enough unless you have thousands of files)
# - inactive=7d is the time that items will remain cached without being accessed (7 days), after which they will be removed
# - use_temp_path=off tells NGINX to write files directly to the cache directory and avoid unnecessary copying of data to a temporary storage area first
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off;
upstream nextjs_upstream {
@sindresorhus
sindresorhus / esm-package.md
Last active May 5, 2024 20:24
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@victor-homyakov
victor-homyakov / links - writing fast code for react and typescript.md
Last active July 11, 2023 00:47
Ссылки для презентации "Код на React и TypeScript, который работает быстро"
@neretin-trike
neretin-trike / pug.md
Last active April 24, 2024 18:22
Туториал по HTML препроцессору Pug (Jade)
@nodkz
nodkz / .babelrc.js
Last active March 25, 2024 16:16
Babel 7.0 with .babelrc.js DEPRECATED! This config was created when babel 7 was in beta
/* eslint-disable prefer-template */
const path = require('path');
const aliases = require('./aliases');
// ///////////////////////////////////////////////////////////////
// ////////////////// PLUGINS ////////////////////////////////
// ///////////////////////////////////////////////////////////////
const commonPlugins = [
@A-gambit
A-gambit / REACTIVE2016-LIGHTNING-PROPOSAL.md
Last active February 22, 2024 18:24
Proposal for lightning talk at ReactiveConf 2016: Road from UndefinedLand

Proposal for a lightning talk at the Reactive 2016.

Keep calm and like/retweet it on Twitter and star this Gist to vote on this talk.

Road from UndefinedLand

Undefiend

I work at Grammarly. We like React and happily use it in our applications. However, sometimes something goes wrong and bugs creep into the code. Here comes testing. It helps make us confident about the quality of our code.

@boccob
boccob / sldes.md
Last active January 23, 2020 15:35
Slides of OdessaJS 2016

Николай Беличук: Карты и картографические сервисы
http://belichuk.github.io/odessajs2016/

Артем Тритяк: Forward to the Past or data fetching in React.js
https://medium.com/@ArtyomTrityak/forward-to-the-past-or-data-fetching-in-react-js-9f4ccfa29c10#.b4lxxf9f5

Юрий Шевцов: Internet of things в офисе
https://docs.google.com/presentation/d/1nhCQQTHeKGXuMMGOyYXDS2z0J7xP6ee8xUGZ0EM22do/edit?usp=sharing

Вадим Макеев: Grid Layout

@tj
tj / update.js
Last active April 29, 2023 14:53
shouldComponentUpdate utility
let rows = {}
export default function(props = [], state = []) {
return function(target) {
const proto = Object.create(target.prototype)
proto.shouldComponentUpdate = function(newProps, newState) {
let id = (this._update_id = this._update_id || Math.random())
@aaronjensen
aaronjensen / connect.jsx
Last active July 28, 2017 18:43
Redux shim for converting from Fluxxor
const React = require('react');
const mapValues = require('lodash/object/mapValues');
const createGetState = require('app/redux_shims/create_get_state');
const Fluxxor = require('fluxxor');
const FluxMixin = Fluxxor.FluxMixin(React);
const StoreWatchMixin = Fluxxor.StoreWatchMixin;
const createDispatcher = require('app/redux_shims/create_dispatcher');
const Router = require('react-router');
function bindActionCreator(flux, router, action) {