Skip to content

Instantly share code, notes, and snippets.

View ivansky's full-sized avatar
😊
Wubba lubba dub dub!

Ivan Martianov ivansky

😊
Wubba lubba dub dub!
  • Armenia, Yerevan
View GitHub Profile
@gaearon
gaearon / uselayouteffect-ssr.md
Last active May 2, 2024 13:42
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {
@ratcashdev
ratcashdev / mytemp_bt.py
Created March 27, 2018 19:01
mitemp_bt implementation for Home-Assistant.io
"""
Support for Xiaomi Mi Temp BLE environmental sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mitemp_bt/
"""
import logging
import voluptuous as vol
@rynffoll
rynffoll / firewalld-activate-vpn-pptp.sh
Created August 10, 2017 18:08
Activate VPN (PPTP) in firewalld
#!/bin/bash
# Activate VPN (PPTP) in firewalld
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p gre -j ACCEPT # ipv4
firewall-cmd --permanent --direct --add-rule ipv6 filter INPUT 0 -p gre -j ACCEPT # ipv6
firewall-cmd --reload
@criminy
criminy / AbstractJdbcRepository.java
Created September 9, 2011 16:43
Implementation of PagingAndSortingRepository using JdbcTemplate
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;