Skip to content

Instantly share code, notes, and snippets.

View makarov-roman's full-sized avatar

Roman Makarov makarov-roman

  • Munich, Germany
View GitHub Profile
@llamadeus
llamadeus / App.tsx
Created November 7, 2021 22:45
Use React.Suspense for Apollo Client React hooks
import { gql, useQuery } from '@apollo/client';
import React, { ReactElement, useEffect, useMemo, useRef } from 'react';
const ME_QUERY = gql`
query Me {
me {
firstName
}
}

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");
@davidmason
davidmason / install-watchman.bash
Created September 13, 2017 03:45
To install watchman on Fedora 26, these are all the hoops I had to jump through.
# The following packages are needed during `make`
# - openssl-devel so you don't get:
# ContentHash.cpp:13:10: fatal error: openssl/sha.h: No such file or directory
# - redhat-rpm-config so you don't get:
# gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
# - python-devel so you don't get:
# pywatchman/bser.c:31:10: fatal error: Python.h: No such file or directory
sudo dnf install openssl-devel redhat-rpm-config python-devel
# The rest is just instructions from
@rsdiaz
rsdiaz / Firefox-Developer-Edition.desktop
Last active August 14, 2018 17:11
Firefox Developer Edition.desktop file for Gnome 3
#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Firefox Developer Edition
Comment=Navegador Firefox Developer Edition
Comment[es]=Accede a Internet.
Exec=/opt/firefox/firefox
StartupNotify=true
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@wizard04wsu
wizard04wsu / rounding.js
Last active August 30, 2019 15:00
Functions to round a number to a specified precision (i.e., a specified number of decimal places).
function roundToPrecision(num, precision){
var shifter;
precision = new Number(precision || 0);
if(precision%1 !== 0) throw new RangeError("precision must be an integer");
shifter = Math.pow(10, precision);
return Math.round(num*shifter)/shifter;
}
function floorToPrecision(num, precision){
var shifter;