Skip to content

Instantly share code, notes, and snippets.

View ezze's full-sized avatar
💭
Back to the heavyweight jam

Dmitriy Pushkov ezze

💭
Back to the heavyweight jam
View GitHub Profile
@apieceofbart
apieceofbart / test.js
Last active January 18, 2024 17:14
Async testing with jest fake timers and promises
PLEASE CHECK THIS REPO WITH THE EXAMPLES THAT YOU CAN RUN:
https://github.com/apieceofbart/async-testing-with-jest-fake-timers-and-promises
// Let's say you have a function that does some async operation inside setTimeout (think of polling for data)
function runInterval(callback, interval = 1000) {
setInterval(async () => {
const results = await Promise.resolve(42) // this might fetch some data from server
callback(results)
}, interval)
@oztune
oztune / install react-devtools v3
Created August 23, 2019 23:26
How to install React Dev Tools v3 so that you can have highlight updates again
1. Somewhere on your machine clone the project.
```
> git clone https://github.com/facebook/react-devtools.git
> cd react-devtools
```
2. Switch to the v3 branch
```
> git checkout v3
```
@stek29
stek29 / proxygram-nginx.conf
Created February 24, 2019 21:52
config for nginx to proxy webogram
server {
server_name gram.com;
location / {
root /var/www/gram;
try_files $uri $uri/index.html;
# protect with basic auth, we don't want to get banned by rkn
auth_basic "webogram";
auth_basic_user_file /var/www/gram.htpasswd;
@andywer
andywer / router-1.ts
Last active August 6, 2020 14:57
Koa: Passing data from middleware to route handler
/*
* Description:
*
* There are times when we want to re-use some data created/derived in a middleware later in a route handler.
*
* The default Koa way of doing so would be using `context.state`. Unfortunately `context.state` is hard to type and
* quite implicit, since it's an object shared and potentially mutated by all middlewares and the route handler.
*/
/*
@magnetikonline
magnetikonline / README.md
Last active March 21, 2024 00:11
Add user ssh-agent as daemon to Ubuntu 18.04LTS server.

Add user ssh-agent as daemon to Ubuntu 18.04LTS server

Create a new systemd user unit, which starts ssh-agent upon login to server. Will remain resident until the final session for the user has logged out.

Steps

  • Create /etc/systemd/user/ssh-agent.service.

  • Run the following commands (under your user account, not root) to install the systemd unit and start:

@Kruemelkatze
Kruemelkatze / ! Theming Ant Design with Sass and Webpack.md
Last active April 5, 2023 13:25
Theming Ant Design with Sass and Webpack

Theming Ant Design with Sass and Webpack

This is a solution on how to theme/customize Ant Design (which is written in Less) with Sass and webpack. Ant itself offers two solutions and a related article on theming, but these are only applicable if you use Less, the antd-init boilerplate or dva-cli.

What this solution offers:

  • use a single sass-file to customize (no duplicate variables for your project and Ant)
  • hot reload compatibility
  • no dependencies on outdated npm modules
  • easy integration with your existing webpack setup (webpack 3+ tested)
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import SphericalMercator from "@mapbox/sphericalmercator";
import { MapView, Constants } from "expo";
const merc = new SphericalMercator();
const getZoomLevelFromRegion = (region, viewport) => {
const { longitudeDelta } = region;
const { width } = viewport;
@attacus
attacus / riot-matrix-workshop.md
Last active March 13, 2024 00:16
Create your own encrypted chat server with Riot and Matrix

This guide is unmaintained and was created for a specific workshop in 2017. It remains as a legacy reference. Use at your own risk.

Running your own encrypted chat service with Matrix and Riot

Workshop Instructor:

This workshop is distributed under a CC BY-SA 4.0 license.

What are we doing here?

@j-jith
j-jith / miui-fastboot-howto.rst
Last active April 26, 2024 02:38
How to flash MIUI Fastboot ROM from Linux

How to flash MIUI Fastboot ROM from Linux

@savely-krasovsky
savely-krasovsky / README.md
Last active February 5, 2023 14:04
Telegram webhooks with nginx reverse proxy

Make config file:

sudo nano /etc/nginx/sites-available/bot.conf

Then copy and paste bot.conf content and edit YOUR.DOMAIN strings. Now install Let's Encrypt on your server. For example in Debian you need to add jessie-backports and easily install it with apt-get:

sudo apt-get install -t jessie-backports letsencrypt

Then get cert for you domain: